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: 12117863 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16774C433E0 for ; Fri, 5 Mar 2021 06:53:16 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8F6F365005 for ; Fri, 5 Mar 2021 06:53:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8F6F365005 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:MIME-Version:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-Id:Date:Subject:Cc:To:From:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=wmXU04M85gcUCOJaka0yCROF8O3RE3hmh4l2ekcijgQ=; b=GkYYlR/d9P6Yw14Mx2HaDcL9oQ q2qCUQOzTztK24n7gZQPyiVUjbykljfZPPNTKMt/hFRPf6ySzNL75UAh0R67Nhr78OqVnOYG4rbeN i2OiNVJGY+ft5M+ROc9XAv/d1rljZIRxj5DXxVM+wgEVT4eAZ7kYXz8TTcs8x/CUb+uPy44KCEypH N3VXgdfpK7YcbLiy+ZyZA4Ykoux2mpxW986xFU0kTNYCT4gM6PdTu11Qp+J6++LTmiG/Z7x2SApiZ JEy7DPWgOorCDkKKEhm4Dbxqnx1mPCKVnaV2Ow10TBBMHbld6YUAPc2Jkmbz4X19Fbdx4JPq0QwxP 5JM6kn+Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lI4JF-00DRjx-8H; Fri, 05 Mar 2021 06:51:37 +0000 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lI4JA-00DRhD-Bg for linux-arm-kernel@lists.infradead.org; Fri, 05 Mar 2021 06:51:34 +0000 Received: by mail-pj1-x102c.google.com with SMTP id kx1so1272696pjb.3 for ; Thu, 04 Mar 2021 22:51:31 -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=j6pFZM7WKNfFtYppfrAd7AN2DPoQjj5jE3go4qKTv6AYThRHJW0HEonpA4LGlHgsVV K4oe5wTnHLGunQUC9AQ03+8Uh9I9JoDqNdqMT+J0/htVaRSKPVeKoTPioSax3ySOzWHG qCaGFIalK4V+rW+XcLwzmWR8z077Hl/JDBePOLb+8c0pxH0phHwHiePGJG2524FNROKw epNVOjAz3oUobjWHlM8fceO2T/F4xxSYl4CFaF7T9UE32CdmTUViyPFrWWr7KR2V9kJN PNAQJR3QFKdrZTylTI9V7u7Wz0zVsB9/H5nvrDk2z2JG+SoFp6AL0dWSIcfnyT/X2tON ttTg== X-Gm-Message-State: AOAM533ZtAV4VaEaZHlim66kNMMzMpynQwxpIWiNEOQofHDdQxoAUG3S 0t/7QaV8E+7qAC4uBpAj/AHifQ== X-Google-Smtp-Source: ABdhPJy28iWsl4+zhRYFn1OA9ZMqc+2MnS79adEhS2kTGg18DVBGP1cvaMahUT5uWDForWgwDEP3Ww== 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210305_065132_617181_DF808EE0 X-CRM114-Status: GOOD ( 12.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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(+) 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); }