From nobody Fri Nov 22 10:55:00 2024 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=1722529108; cv=none; d=zohomail.com; s=zohoarc; b=V+ddpLbrB+pOsrfblMd/rKebbFf9iLRwvtRadGGmpT8YI2Iea/cfFWRvw4C+O+AcZe5wBr+xHK/KAfXdq2RbmAxDz7USDnQ24nz0hxfWqRtoVWzu3cfr+853Yr3BggC8QBNaQBRGu/lYcUk3HjvzznCiIH1WnVbWJkd3H03p91Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722529108; 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=3/ARuhRsNaiuIPRwu1nLQkVqTSbqQTI1K6+W0XQ7am4=; b=h9/HUT/qrGotC6nDNlnK/jT0+eMY14J/qR0BJ6gLWlCSyOZual7mQfSj8bfaQVec81XPM0P7xmF24jS+Cj4OHDdk76lbUaeyVixYRgWjG2tHlwPwWtkwDDmugF8TqCXMgZDY+Fp5TrbUvgFkA4ewWvi0S3X21fn/HtdP9AYLwDI= 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 1722529108169446.43865765699695; Thu, 1 Aug 2024 09:18:28 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.769874.1180755 (Exim 4.92) (envelope-from ) id 1sZYVC-0004do-Jr; Thu, 01 Aug 2024 16:18:06 +0000 Received: by outflank-mailman (output) from mailman id 769874.1180755; Thu, 01 Aug 2024 16:18:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sZYVC-0004de-EV; Thu, 01 Aug 2024 16:18:06 +0000 Received: by outflank-mailman (input) for mailman id 769874; Thu, 01 Aug 2024 16:18:05 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sZYVA-0004dY-VB for xen-devel@lists.xenproject.org; Thu, 01 Aug 2024 16:18:04 +0000 Received: from mail-qv1-xf2d.google.com (mail-qv1-xf2d.google.com [2607:f8b0:4864:20::f2d]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a001faa3-5021-11ef-8776-851b0ebba9a2; Thu, 01 Aug 2024 18:18:02 +0200 (CEST) Received: by mail-qv1-xf2d.google.com with SMTP id 6a1803df08f44-6bb5a4668faso36647956d6.2 for ; Thu, 01 Aug 2024 09:18:02 -0700 (PDT) Received: from localhost ([213.195.124.163]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6bb99b5d0b0sm32846d6.124.2024.08.01.09.18.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 09:18:00 -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" X-Inumbo-ID: a001faa3-5021-11ef-8776-851b0ebba9a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1722529081; x=1723133881; 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=3/ARuhRsNaiuIPRwu1nLQkVqTSbqQTI1K6+W0XQ7am4=; b=tHHG/6wlvU8zuLkxJ4/FLd8EhCfK2mb13mYkKDuUXgzzUp8LlkvPfKq361SYOiPk1w KaHPZQpudDnsgSmYRZ41NsexWD6SVM9PoI1RpDeDrCrAPBVWH+VsfJM6FDFHIEkq6YoW ycrusMXjVLfm+LfhrQzXVrg/Pd20oTTgpDpcI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722529081; x=1723133881; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3/ARuhRsNaiuIPRwu1nLQkVqTSbqQTI1K6+W0XQ7am4=; b=lSzLR/ugQYXFHlkcn8ue9KCk0IEfaAS7bz8YbA/h6xcxtkPaivbrIOneLJNcc0bqoK XA24n3SKF5LEmTimlY2sCU1kgeaxSckiOX5KWoxZwsdHF6EV1vWdAApbQZ2xelwlNIJa FN2B+AbePiszTftF6163oD4MU7fAUefeSNicNu+sqDveG6m4R4ysbHVaygi5mlN8gfFW +J3asvNBWH8HbfsLdc29BtJC5v1NUc5kvKszcRWPlVT4QyPMze9/0MrZCSNrJ+GtoAbn FgjXAdSAwmpeuwhaprwtDkK1gLPuszap9HrbamNn88vdqGLdfoq5iyufLMxYtFSRYQGZ lNxg== X-Gm-Message-State: AOJu0YxtNUD493XBGpiaMXAWKxyAxaFn3Zpc9P6IHuEaGJcYajXhHGfa pd77SIPn2i48awtpI6AYlaDwLXw3KgJwlkXBeBfQZRTAl/OFfl0V13zCaY/VRIDqfJwiFS0od2E S X-Google-Smtp-Source: AGHT+IFO/rWeumFqH0B5iLXR8PFwzwGoJfb59JcIhxPp7M3Ne17LK97renedcpnge+DVS6DbvZWHkw== X-Received: by 2002:a05:6214:5bc2:b0:6b5:e202:bd78 with SMTP id 6a1803df08f44-6bb98417517mr6761646d6.44.1722529080891; Thu, 01 Aug 2024 09:18:00 -0700 (PDT) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Jan Beulich , Andrew Cooper , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Subject: [PATCH v3] x86/shutdown: change default reboot method preference Date: Thu, 1 Aug 2024 18:17:53 +0200 Message-ID: <20240801161753.94399-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1722529108738116600 The current logic to chose the preferred reboot method is based on the mode= Xen has been booted into, so if the box is booted from UEFI, the preferred rebo= ot method will be to use the ResetSystem() run time service call. However, that method seems to be widely untested, and quite often leads to a result similar to: Hardware Dom0 shutdown: rebooting machine Acked-by: Marek Marczykowski-G=C3=B3recki ----[ Xen-4.18-unstable x86_64 debug=3Dy Tainted: C ]---- CPU: 0 RIP: e008:[<0000000000000017>] 0000000000000017 RFLAGS: 0000000000010202 CONTEXT: hypervisor [...] Xen call trace: [<0000000000000017>] R 0000000000000017 [] S ffff83207eff7b50 [] F machine_restart+0x1da/0x261 [] F apic_wait_icr_idle+0/0x37 [] F smp_call_function_interrupt+0xc7/0xcb [] F call_function_interrupt+0x20/0x34 [] F do_IRQ+0x150/0x6f3 [] F common_interrupt+0x132/0x140 [] F arch/x86/acpi/cpu_idle.c#acpi_idle_do_entry+0x113= /0x129 [] F arch/x86/acpi/cpu_idle.c#acpi_processor_idle+0x3e= b/0x5f7 [] F arch/x86/domain.c#idle_loop+0xec/0xee **************************************** Panic on CPU 0: FATAL TRAP: vector =3D 6 (invalid opcode) **************************************** Which in most cases does lead to a reboot, however that's unreliable. Change the default reboot preference to prefer ACPI over UEFI if available = and not in reduced hardware mode. This is in line to what Linux does, so it's unlikely to cause issues on cur= rent and future hardware, since there's a much higher chance of vendors testing hardware with Linux rather than Xen. Add a special case for one Acer model that does require being rebooted using ResetSystem(). See Linux commit 0082517fa4bce for rationale. Signed-off-by: Roger Pau Monn=C3=A9 Acked-by: Marek Marczykowski-G=C3=B3recki --- Changes since v2: - Rebase and remove incorrect paragraph from the commit message. Changes since v1: - Add special case for Acer model to use UEFI reboot. - Adjust commit message. --- xen/arch/x86/shutdown.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/shutdown.c b/xen/arch/x86/shutdown.c index acceec2a385d..fa60d1638d58 100644 --- a/xen/arch/x86/shutdown.c +++ b/xen/arch/x86/shutdown.c @@ -150,19 +150,20 @@ static void default_reboot_type(void) =20 if ( xen_guest ) reboot_type =3D BOOT_XEN; + else if ( !acpi_disabled && !acpi_gbl_reduced_hardware ) + reboot_type =3D BOOT_ACPI; else if ( efi_enabled(EFI_RS) ) reboot_type =3D BOOT_EFI; - else if ( acpi_disabled ) - reboot_type =3D BOOT_KBD; else - reboot_type =3D BOOT_ACPI; + reboot_type =3D BOOT_KBD; } =20 static int __init cf_check override_reboot(const struct dmi_system_id *d) { enum reboot_type type =3D (long)d->driver_data; =20 - if ( type =3D=3D BOOT_ACPI && acpi_disabled ) + if ( (type =3D=3D BOOT_ACPI && acpi_disabled) || + (type =3D=3D BOOT_EFI && !efi_enabled(EFI_RS)) ) type =3D BOOT_KBD; =20 if ( reboot_type !=3D type ) @@ -172,6 +173,7 @@ static int __init cf_check override_reboot(const struct= dmi_system_id *d) [BOOT_KBD] =3D "keyboard controller", [BOOT_ACPI] =3D "ACPI", [BOOT_CF9] =3D "PCI", + [BOOT_EFI] =3D "UEFI", }; =20 reboot_type =3D type; @@ -492,6 +494,15 @@ static const struct dmi_system_id __initconstrel reboo= t_dmi_table[] =3D { DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge R740")), }, + { /* Handle problems with rebooting on Acer TravelMate X514-51T. */ + .callback =3D override_reboot, + .driver_data =3D (void *)(long)BOOT_EFI, + .ident =3D "Acer TravelMate X514-51T", + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), + DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate X514-51T"), + }, + }, { } }; =20 --=20 2.45.2