From patchwork Fri Mar 5 06:51:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 393471 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp174991jai; Thu, 4 Mar 2021 22:51:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJy1+FwK1TwOF9p64+3ddd2Y+P/ELs85ws2BToscOvTeRuBhVjEoOm8tPVryrMvVzr0t54C3 X-Received: by 2002:a05:6402:31a7:: with SMTP id dj7mr7914406edb.33.1614927092462; Thu, 04 Mar 2021 22:51:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614927092; cv=none; d=google.com; s=arc-20160816; b=rDG4OeLBbYqYIBG6t9ZL3oPPUQda+wvgKfWWFEogi3BLCvRVZZygL2/9vLxXVrhBbe u8Rp8/YPSiDLA6bPnOS/RQOu+9b+AlUjC5ukWTi+GToaZDmd6vlLadvsZBuYkYam4Vl7 X9euTG/fuHw6FnpXP852yTfmvq8AgSGOvJZRHPlTIAykqvh9Z6qgtMIQsrnTSpmSimXu GHQNZbk2k9DDVrRYTgqpypLX2lx9FVzjIEq6kheiyYYXhAaoj3Iwg5YDg8d/1MFDKUID xXD0Pdr3bPTypH6a0NipKGSNk2hLwXcVCGyUXFdISMivYaOoQ9IHYB0tPKhI44gyPXs7 VxLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=ylMLa5HeZunolCrxNpnLV11Rpx2fup4TKTrVHiQOU3U=; b=TIlX3V/Awh/sMYiY3b+4lW94pTkE8H4iZwKjXA+MPrXOXuREmVKmiCTQ1p1fgURRct nFZ9F0nsLvceovmtrkC+wwBTYxT62Qv/dZX2gyPK4/VobqWwXMxOJXPW/6g9PCaz4UBe 3ERkBIrU9gHLZUtOjstQE0muS4qyvsvcIIA//iyltF4ZfKIQgp+MB4rtBnM7E+K89Ejw o5ebtLixvoQ3rOkGHUebjNGYFg3LjNxQ9nfixhWISovGLqdls0WmCi2kPM2uYim8A2vs 8u6r3vOsFjdG/+WpGWBiiFqmhNLrk9BTY9FqLNwljZwsHJ6eP8AluR6ygl9VnO8watHx 1l1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rNisq513; spf=pass (google.com: domain of linux-efi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b17si1128539edn.294.2021.03.04.22.51.32; Thu, 04 Mar 2021 22:51:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-efi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rNisq513; spf=pass (google.com: domain of linux-efi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229458AbhCEGvb (ORCPT + 1 other); Fri, 5 Mar 2021 01:51:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbhCEGva (ORCPT ); Fri, 5 Mar 2021 01:51:30 -0500 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 783CDC061574 for ; Thu, 4 Mar 2021 22:51:30 -0800 (PST) Received: by mail-pj1-x1033.google.com with SMTP id cl21-20020a17090af695b02900c61ac0f0e9so1727981pjb.1 for ; Thu, 04 Mar 2021 22:51:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=ylMLa5HeZunolCrxNpnLV11Rpx2fup4TKTrVHiQOU3U=; b=rNisq513EGCX6tfWkzogcERqNZsSkzqFclF5sVaaAfKds223kD+oHMEqP3UDlZQvvG O3cT/fUPoCfA+jS6hpsC1rT/tgbIG6iwUN7+eWBjaUI6zqPDMul4RUV6oV1l/2fXnF8l gAtN2m4uFckt0n7pbj6PlHfJMhnfzHUZmcKIblB4XW7GS5MzOPZcR5Q2vIbDS7QuwaUr cYngL2N6xBMxwIgddHgzYAnj8xFcgAbRHvgdkXluioGbsPO9t8DJPRCKHJKvZw3nMbEU Bp+cgxOh0+TlfeM/1KfIVuoHF74o5I+WAKD2tjeoJrzWLC1sRo1gpJzLP3uOpf9zDTdw B58w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ylMLa5HeZunolCrxNpnLV11Rpx2fup4TKTrVHiQOU3U=; b=tMRV6aYVBIQrdF3YExCOcGQMGJWdNIQ1vcA6inCLEvRK8ZP4HO2IOovCKEp5Ysbw/e QpYkjjWXEuPeNE1Q32ppyUSDQZWfOWTx0RJqNLjnlZOhKI+dThnWtZpfo1dEQrIp5RGi 3pBPUIEhlIGqiayZcVUVG6duP8XIAKL8XhO8UtpLAiZkw/iPZoTY9O7rjF9fKzjfLIv0 WRy4/ih38BMX7CLItz1hAUEyJWgLAQ+v9Kj05Nf1shb/WSncQBicCNvAn3K1dtmcHHwd TSMHsDVy0J8UGeS/5SAZywKlPVcNKyCoH1PgI9y65TXaiuWoijkztWhs0SPM0on18H/C aJhQ== X-Gm-Message-State: AOAM531KYfQS3tFgbx0fra+1Wc7xnm2zC1fQbd4zVtzxNp+Lfzgaw2kU p5NyaRCQuABpbvNZ/P35dW11Ow== X-Received: by 2002:a17:902:7c8e:b029:e5:f70f:b7ab with SMTP id y14-20020a1709027c8eb02900e5f70fb7abmr860503pll.32.1614927090074; Thu, 04 Mar 2021 22:51:30 -0800 (PST) Received: from localhost.localdomain (80.251.214.228.16clouds.com. [80.251.214.228]) by smtp.gmail.com with ESMTPSA id c4sm1472874pfo.2.2021.03.04.22.51.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Mar 2021 22:51:27 -0800 (PST) From: Shawn Guo To: Ard Biesheuvel Cc: Catalin Marinas , Will Deacon , Jeffrey Hugo , Bjorn Andersson , linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Shawn Guo Subject: [PATCH] arm64: efi: add check for broken efi poweroff Date: Fri, 5 Mar 2021 14:51:20 +0800 Message-Id: <20210305065120.11355-1-shawn.guo@linaro.org> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Poweroff via UEFI Runtime Services doesn't always work on every single arm64 machine. For example, on Lenovo Flex 5G laptop, it results in a system reboot rather than shutdown. Add a DMI check to keep such system stay with the original poweroff method (PSCI). Signed-off-by: Shawn Guo --- arch/arm64/kernel/efi.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) -- 2.17.1 diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c index fa02efb28e88..8ae0002c72f1 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c @@ -7,6 +7,7 @@ * Copyright (C) 2013, 2014 Linaro Ltd. */ +#include #include #include @@ -113,12 +114,26 @@ int __init efi_set_mapping_permissions(struct mm_struct *mm, set_permissions, md); } +static const struct dmi_system_id efi_reboot_broken_table[] = { + { + .ident = "Lenovo Flex 5G", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_FAMILY, "Flex 5G"), + }, + }, + { } /* terminator */ +}; + /* * UpdateCapsule() depends on the system being shutdown via * ResetSystem(). */ bool efi_poweroff_required(void) { + if (dmi_check_system(efi_reboot_broken_table)) + return false; + return efi_enabled(EFI_RUNTIME_SERVICES); }