From nobody Sat Jun 13 07:32:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1781260085; cv=none; d=zohomail.com; s=zohoarc; b=NABB0MKoqHw+6Y5+NB0r4RwFi4cIpQ61XfmH/1TJM3Ndp7IsGrxJYyP6Q+MLCgCMfQ1kRT0XvZWcph6xsUcj91V624u2kLcjQK11hX0lw/+D+RrUtw046LV5UDLbpv0E8jw87aG+JHLqL1ZMIw24YolXSPrDRdEB6RnfAKZo44o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781260085; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=CFbdcue/z3xdCwKAm7oVToWlHnJSjldtNGJ5sUlNn6Q=; b=njp536Md3qGRTsfn/YAv7GoVjlCmYW5x2LGR1x+4OAkGQ5p2wlggvv1zn4S+C4FgwGq7ZtfIqmHac4nn7DvQpJQdXSfKePyo+P6McT9qnfgGZzjBkTp2zEfNY/6F+bwgDymgCoXmbxdKUSGzzSDp6b1DnlBNgV15L8x6pBNAqaY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 178126008589353.28891086726526; Fri, 12 Jun 2026 03:28:05 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1336587.1598421 (Exim 4.92) (envelope-from ) id 1wXz6t-0007Ma-Ul; Fri, 12 Jun 2026 10:27:35 +0000 Received: by outflank-mailman (output) from mailman id 1336587.1598421; Fri, 12 Jun 2026 10:27:35 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wXz6t-0007MT-S4; Fri, 12 Jun 2026 10:27:35 +0000 Received: by outflank-mailman (input) for mailman id 1336587; Fri, 12 Jun 2026 10:27:35 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) id 1wXz6t-0007LY-4G for xen-devel@lists.xenproject.org; Fri, 12 Jun 2026 10:27:35 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wXz6s-005BVI-3O for xen-devel@lists.xenproject.org; Fri, 12 Jun 2026 12:27:34 +0200 Received: from [10.42.69.9] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a2bdf0f-e002-0a2a0a5209dd-0a2a4509a65e-18 for ; Fri, 12 Jun 2026 12:27:33 +0200 Received: from [209.85.128.47] (helo=mail-wm1-f47.google.com) by tlsNG-bad1c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.56.1) (envelope-from ) id 6a2bdf15-2497-0a2a45090019-d155802ff0cb-3 for ; Fri, 12 Jun 2026 12:27:33 +0200 Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-491609cdd8fso2029625e9.2 for ; Fri, 12 Jun 2026 03:27:33 -0700 (PDT) Received: from localhost.localdomain (host-78-146-242-105.as13285.net. [78.146.242.105]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4606f26393asm4437355f8f.5.2026.06.12.03.27.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2026 03:27:32 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=citrix.com header.i="@citrix.com" header.h="Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1781260053; x=1781864853; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=CFbdcue/z3xdCwKAm7oVToWlHnJSjldtNGJ5sUlNn6Q=; b=LEiEn9L5VRG1Pq7ZqGDpn/L3RH4H5X7hfZCClqgM93zTY0GewV03e9C5UXFRlpIKlK E3nZl+vV5OPwy6T8Gnp92vDFo2YR5pXk7SI1TF/Op2losZ8He1zFVdcbzHY9DKWOS/UG OPctODnBI3XlmbxcwZ+qtTbZvJ0e9DNMJKu08= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781260053; x=1781864853; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=CFbdcue/z3xdCwKAm7oVToWlHnJSjldtNGJ5sUlNn6Q=; b=KJorWLt9vC+1uCjowsCGWyRx27MMiCilMTEO9Md1Jodk81qdWJxJDoKq/Xy4TDFXv1 3KpqiVI20OoLwVOobl2OuBenekQ+OAzr+DHAk5oYPHvfzMM1+Yqnv6FdN8WlWZL4/0j4 wsxIHf3oCQLOPt3wBhewZBM0+PrpBYDqwXyS0P0cGbZIkufzKzEqjiZsNoI8ZD4WKPoO w5EYmhdHlmfwX887F4v+ki48wYnejn3vo17eEhxPrKHsl0JlVYpDqO0AdO7g73pplCb5 PtY14OFradtogUNC3tPYYoSgXG64i/Mp6mAP459tfXimY1i0msspT13kYIG7lAJMahXI bS9A== X-Gm-Message-State: AOJu0YygUjFhd98PjwRo3p7iApSmUJ+5IxLqq+sLpSBJ6HcrI0HC88ck +mUcUhJVE8O6T2JsPHRL0H2xZvKLMGhvUP5ZkfOfGuXWW9M3iU1NHyOpQ7h9/5rRcn3nxeWg0SJ HJFHb X-Gm-Gg: Acq92OFdD5Q9uN/Q0DSk++3Tc0EnM10T7CzHZsDV01RlEbR+ls2Uqnt1Qu2T38RCpkD hQrC+h/2qFuYyszaCbLo/C7ZKHodNn2C2SO6qSAwzVvpuxk+SSrXMbB2yn/k3CLdjQnJjA/a5Gr 6iFOSZCwmSE9rME60kViwpi6K6own7yg2n+poWMN09r+ZLzV62ly/UjqYFpvJIsCsDn3m+mJHET CUK5jXLxqMHpf/wI2g8uyotpYaYSq1AFAjCr6f7URnU7BO7iDoKO1xnQNNieJAau8wtNiXE/vHq dlYdPT6hIhzWI5yvkJ2CzB+OakneimNj14s7b8i8+cNqyPVKR3Fyl1Z6Xx6JSfRlp2QA8YCmyYf RRc+lcnWYiWA0yyTigemuqW5j0YuVZPnsV5pOXndQ8rVjVLcomPvh2pOEM81II4Sr2+ymmeutZc W6Y6GW5P1iA/CBgKleCVaZZ6mpljZhPaDigiRF+vF3sgAU+E6/ehJDKTT7Aoujtzwq8pT/lVCSd GFa X-Received: by 2002:a05:6000:40cc:b0:441:1e41:19c with SMTP id ffacd0b85a97d-4606dbad4a3mr3269892f8f.20.1781260052741; Fri, 12 Jun 2026 03:27:32 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Anthony PERARD , Michal Orzel , Jan Beulich , Julien Grall , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini , Oleksii Kurochko , Kevin Lampis Subject: [PATCH for-4.23] xen/kexec: Drop the obsolete v1 hypercall implementation Date: Fri, 12 Jun 2026 11:27:27 +0100 Message-Id: <20260612102727.3121098-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-bad1c0/1781260053-4377AA53-EDD3084B/10/73395122804 X-purgate-type: spam X-purgate-size: 13493 X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1781260087630158500 The v1 interface was declared obsolete in Xen 4.4 (2013) when kexec in Xen = was overhauled. The only known user of the v1 interface was the classic-xen fork of Linux. Linux PVOps does not interact with Xen kexec directly, delegating it entire= ly to userspace (i.e. kexec-tools). Xen support in kexec-tools was part of th= is work, and uses the "new" interface. As such, there's no way to test changes to the interface any more. Signed-off-by: Andrew Cooper Acked-by: Oleksii Kurochko # CHANGELOG.md --- CC: Anthony PERARD CC: Michal Orzel CC: Jan Beulich CC: Julien Grall CC: Roger Pau Monn=C3=A9 CC: Stefano Stabellini CC: Oleksii Kurochko CC: Kevin Lampis For 4.23, but I'd like to get this into my for-next branch nowish so other work can be rebased over it. This patch will need rebasing over release activities in CHANGELOG.md but that's easy to do. Bloat-o-meter reports: add/remove: 1/3 grow/shrink: 0/4 up/down: 152/-1431 (-1279) Function old new delta kexec_swap_images - 152 +152 symbols_sorted_offsets 69592 69576 -16 symbols_offsets 53668 53652 -16 symbols_names 135309 135272 -37 do_kexec_op_internal 2038 1994 -44 kexec_do_unload.isra 170 - -170 kexec_load_slot 510 - -510 kexec_do_load_v1 638 - -638 --- CHANGELOG.md | 8 ++ xen/common/kexec.c | 241 +------------------------------------ xen/include/public/kexec.h | 45 +------ xen/include/xlat.lst | 1 - 4 files changed, 13 insertions(+), 282 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cf19372a361..5c1113ab61af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ Notable changes to Xen will be documented in this file. =20 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.= 0.0/) =20 +## [4.23.0 UNRELEASED](https://xenbits.xenproject.org/gitweb/?p=3Dxen.git;= a=3Dshortlog;h=3Dstaging) - TBD + +### Removed + - On x86: + - The kexec "v1" interface, which was declared obsolete in Xen 4.4 (201= 3). + The only know user was the classic-xen fork of Linux. This does not + affect Xen kexec support in the kexec-tools package. + ## [4.22.0 UNRELEASED](https://xenbits.xenproject.org/gitweb/?p=3Dxen.git;= a=3Dshortlog;h=3Dstaging) - TBD =20 ### Changed diff --git a/xen/common/kexec.c b/xen/common/kexec.c index 65776a95fd70..fec67ed6936d 100644 --- a/xen/common/kexec.c +++ b/xen/common/kexec.c @@ -900,206 +900,6 @@ static int kexec_load_slot(struct kexec_image *kimage) return 0; } =20 -static uint16_t kexec_load_v1_arch(void) -{ -#ifdef CONFIG_X86 - return is_pv_32bit_domain(hardware_domain) ? EM_386 : EM_X86_64; -#else - return EM_NONE; -#endif -} - -static int kexec_segments_add_segment(unsigned int *nr_segments, - xen_kexec_segment_t *segments, - mfn_t mfn) -{ - paddr_t maddr =3D mfn_to_maddr(mfn); - unsigned int n =3D *nr_segments; - - /* Need a new segment? */ - if ( n =3D=3D 0 - || segments[n-1].dest_maddr + segments[n-1].dest_size !=3D maddr ) - { - n++; - if ( n > KEXEC_SEGMENT_MAX ) - return -EINVAL; - *nr_segments =3D n; - - set_xen_guest_handle(segments[n-1].buf.h, NULL); - segments[n-1].buf_size =3D 0; - segments[n-1].dest_maddr =3D maddr; - segments[n-1].dest_size =3D 0; - } - - return 0; -} - -static int kexec_segments_from_ind_page(mfn_t mfn, - unsigned int *nr_segments, - xen_kexec_segment_t *segments, - bool compat) -{ - void *page; - kimage_entry_t *entry; - int ret =3D 0; - - page =3D map_domain_page(mfn); - - /* - * Walk the indirection page list, adding destination pages to the - * segments. - */ - for ( entry =3D page; ; ) - { - unsigned long ind; - - ind =3D kimage_entry_ind(entry, compat); - mfn =3D kimage_entry_mfn(entry, compat); - - switch ( ind ) - { - case IND_DESTINATION: - ret =3D kexec_segments_add_segment(nr_segments, segments, mfn); - if ( ret < 0 ) - goto done; - break; - case IND_INDIRECTION: - unmap_domain_page(page); - entry =3D page =3D map_domain_page(mfn); - continue; - case IND_DONE: - goto done; - case IND_SOURCE: - if ( *nr_segments =3D=3D 0 ) - { - ret =3D -EINVAL; - goto done; - } - segments[*nr_segments-1].dest_size +=3D PAGE_SIZE; - break; - default: - ret =3D -EINVAL; - goto done; - } - entry =3D kimage_entry_next(entry, compat); - } -done: - unmap_domain_page(page); - return ret; -} - -static int kexec_do_load_v1(xen_kexec_load_v1_t *load, int compat) -{ - struct kexec_image *kimage =3D NULL; - xen_kexec_segment_t *segments; - uint16_t arch; - unsigned int nr_segments =3D 0; - mfn_t ind_mfn =3D maddr_to_mfn(load->image.indirection_page); - int ret; - - arch =3D kexec_load_v1_arch(); - if ( arch =3D=3D EM_NONE ) - return -ENOSYS; - - segments =3D xmalloc_array(xen_kexec_segment_t, KEXEC_SEGMENT_MAX); - if ( segments =3D=3D NULL ) - return -ENOMEM; - - /* - * Work out the image segments (destination only) from the - * indirection pages. - * - * This is needed so we don't allocate pages that will overlap - * with the destination when building the new set of indirection - * pages below. - */ - ret =3D kexec_segments_from_ind_page(ind_mfn, &nr_segments, segments, = compat); - if ( ret < 0 ) - goto error; - - ret =3D kimage_alloc(&kimage, load->type, arch, load->image.start_addr= ess, - nr_segments, segments); - if ( ret < 0 ) - goto error; - - /* - * Build a new set of indirection pages in the native format. - * - * This walks the guest provided indirection pages a second time. - * The guest could have altered then, invalidating the segment - * information constructed above. This will only result in the - * resulting image being potentially unrelocatable. - */ - ret =3D kimage_build_ind(kimage, ind_mfn, compat); - if ( ret < 0 ) - goto error; - - if ( arch =3D=3D EM_386 || arch =3D=3D EM_X86_64 ) - { - /* - * Ensure 0 - 1 MiB is mapped and accessible by the image. - * - * This allows access to VGA memory and the region purgatory copies - * in the crash case. - */ - unsigned long addr; - - for ( addr =3D 0; addr < MB(1); addr +=3D PAGE_SIZE ) - { - ret =3D machine_kexec_add_page(kimage, addr, addr); - if ( ret < 0 ) - goto error; - } - } - - ret =3D kexec_load_slot(kimage); - if ( ret < 0 ) - goto error; - - return 0; - -error: - if ( !kimage ) - xfree(segments); - kimage_free(kimage); - return ret; -} - -static int kexec_load_v1(XEN_GUEST_HANDLE_PARAM(void) uarg) -{ - xen_kexec_load_v1_t load; - - if ( unlikely(copy_from_guest(&load, uarg, 1)) ) - return -EFAULT; - - return kexec_do_load_v1(&load, 0); -} - -static int kexec_load_v1_compat(XEN_GUEST_HANDLE_PARAM(void) uarg) -{ -#ifdef CONFIG_COMPAT - compat_kexec_load_v1_t compat_load; - xen_kexec_load_v1_t load; - - if ( unlikely(copy_from_guest(&compat_load, uarg, 1)) ) - return -EFAULT; - - /* This is a bit dodgy, load.image is inside load, - * but XLAT_kexec_load (which is automatically generated) - * doesn't translate load.image (correctly) - * Just copy load->type, the only other member, manually instead. - * - * XLAT_kexec_load(&load, &compat_load); - */ - load.type =3D compat_load.type; - XLAT_kexec_image(&load.image, &compat_load.image); - - return kexec_do_load_v1(&load, 1); -#else - return 0; -#endif -} - static int kexec_load(XEN_GUEST_HANDLE_PARAM(void) uarg) { xen_kexec_load_t load; @@ -1159,34 +959,6 @@ static int kexec_do_unload(xen_kexec_unload_t *unload) return 0; } =20 -static int kexec_unload_v1(XEN_GUEST_HANDLE_PARAM(void) uarg) -{ - xen_kexec_load_v1_t load; - xen_kexec_unload_t unload; - - if ( copy_from_guest(&load, uarg, 1) ) - return -EFAULT; - - unload.type =3D load.type; - return kexec_do_unload(&unload); -} - -static int kexec_unload_v1_compat(XEN_GUEST_HANDLE_PARAM(void) uarg) -{ -#ifdef CONFIG_COMPAT - compat_kexec_load_v1_t compat_load; - xen_kexec_unload_t unload; - - if ( copy_from_guest(&compat_load, uarg, 1) ) - return -EFAULT; - - unload.type =3D compat_load.type; - return kexec_do_unload(&unload); -#else - return 0; -#endif -} - static int kexec_unload(XEN_GUEST_HANDLE_PARAM(void) uarg) { xen_kexec_unload_t unload; @@ -1234,18 +1006,7 @@ static int do_kexec_op_internal(unsigned long op, else ret =3D kexec_get_range(uarg); break; - case KEXEC_CMD_kexec_load_v1: - if ( compat ) - ret =3D kexec_load_v1_compat(uarg); - else - ret =3D kexec_load_v1(uarg); - break; - case KEXEC_CMD_kexec_unload_v1: - if ( compat ) - ret =3D kexec_unload_v1_compat(uarg); - else - ret =3D kexec_unload_v1(uarg); - break; + case KEXEC_CMD_kexec: ret =3D kexec_exec(uarg); break; diff --git a/xen/include/public/kexec.h b/xen/include/public/kexec.h index 40d79e936b86..abb2a49238f1 100644 --- a/xen/include/public/kexec.h +++ b/xen/include/public/kexec.h @@ -41,10 +41,6 @@ =20 #include "xen.h" =20 -#if defined(__i386__) || defined(__x86_64__) -#define KEXEC_XEN_NO_PAGES 17 -#endif - /* * Prototype for this hypercall is: * int kexec_op(unsigned long cmd, void *args) @@ -66,24 +62,6 @@ #define KEXEC_TYPE_DEFAULT 0 #define KEXEC_TYPE_CRASH 1 =20 - -/* The kexec implementation for Xen allows the user to load two - * types of kernels, KEXEC_TYPE_DEFAULT and KEXEC_TYPE_CRASH. - * All data needed for a kexec reboot is kept in one xen_kexec_image_t - * per "instance". The data mainly consists of machine address lists to pa= ges - * together with destination addresses. The data in xen_kexec_image_t - * is passed to the "code page" which is one page of code that performs - * the final relocations before jumping to the new kernel. - */ - -typedef struct xen_kexec_image { -#if defined(__i386__) || defined(__x86_64__) - unsigned long page_list[KEXEC_XEN_NO_PAGES]; -#endif - unsigned long indirection_page; - unsigned long start_address; -} xen_kexec_image_t; - /* * Perform kexec having previously loaded a kexec or kdump kernel * as appropriate. @@ -109,16 +87,11 @@ typedef struct xen_kexec_exec { } xen_kexec_exec_t; =20 /* - * Load/Unload kernel image for kexec or kdump. - * type =3D=3D KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH [in] - * image =3D=3D relocation information for kexec (ignored for unload) [in] + * Obsolete since Xen 4.4. Removed in Xen 4.23 + * +#define KEXEC_CMD_kexec_load_v1 1 +#define KEXEC_CMD_kexec_unload_v1 2 */ -#define KEXEC_CMD_kexec_load_v1 1 /* obsolete since 0x00040400 */ -#define KEXEC_CMD_kexec_unload_v1 2 /* obsolete since 0x00040400 */ -typedef struct xen_kexec_load_v1 { - int type; - xen_kexec_image_t image; -} xen_kexec_load_v1_t; =20 #define KEXEC_RANGE_MA_CRASH 0 /* machine address and size of crash a= rea */ #define KEXEC_RANGE_MA_XEN 1 /* machine address and size of Xen its= elf */ @@ -149,7 +122,6 @@ typedef struct xen_kexec_range { unsigned long start; } xen_kexec_range_t; =20 -#if __XEN_INTERFACE_VERSION__ >=3D 0x00040400 /* * A contiguous chunk of a kexec image and it's destination machine * address. @@ -224,15 +196,6 @@ typedef struct xen_kexec_status { } xen_kexec_status_t; DEFINE_XEN_GUEST_HANDLE(xen_kexec_status_t); =20 -#else /* __XEN_INTERFACE_VERSION__ < 0x00040400 */ - -#define KEXEC_CMD_kexec_load KEXEC_CMD_kexec_load_v1 -#define KEXEC_CMD_kexec_unload KEXEC_CMD_kexec_unload_v1 -#define xen_kexec_load xen_kexec_load_v1 -#define xen_kexec_load_t xen_kexec_load_v1_t - -#endif - #endif /* _XEN_PUBLIC_KEXEC_H */ =20 /* diff --git a/xen/include/xlat.lst b/xen/include/xlat.lst index 9d08dcc4bb11..33dc8e2b2a4a 100644 --- a/xen/include/xlat.lst +++ b/xen/include/xlat.lst @@ -127,7 +127,6 @@ ? hypfs_dirlistentry hypfs.h =20 ? kexec_exec kexec.h -! kexec_image kexec.h ! kexec_range kexec.h =20 ! add_to_physmap memory.h --=20 2.39.5