From mboxrd@z Thu Jan 1 00:00:00 1970 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=-13.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 BD360C3E8C5 for ; Fri, 27 Nov 2020 19:48:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4CE5A20885 for ; Fri, 27 Nov 2020 19:48:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=gmx.net header.i=@gmx.net header.b="jvX7XMEx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730256AbgK0TsY (ORCPT ); Fri, 27 Nov 2020 14:48:24 -0500 Received: from mout.gmx.net ([212.227.17.20]:57173 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730084AbgK0Tpq (ORCPT ); Fri, 27 Nov 2020 14:45:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1606506084; bh=wu2nZP4IU+Top3OJoASjBBseXIv67/YM1/7RX5sWhD0=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=jvX7XMEx7fnA1DeOff7TSpbnP6OqTJJOqVo4A7JtM4lpeALPWTWVDV0kATIHO35eu fsOaz/vrfl72PhphqyDLGGHDrIGdMX1zoiGMWCBAukHPzrJ0hFwPt3BpDYnotxuHoj F7CGg6LZcOaPKCKx9pKBUHVdKFVtXrWeFg/+ST64= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from pinea64lts.fritz.box ([62.143.246.89]) by mail.gmx.com (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1N5GE1-1k1fCx3yCb-011BwR; Fri, 27 Nov 2020 20:20:59 +0100 From: Heinrich Schuchardt To: Ivan Hu , Ard Biesheuvel Cc: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Colin King , fwts-devel@lists.ubuntu.com, Heinrich Schuchardt Subject: [PATCH 1/1] efi/efi_test: read RuntimeServicesSupported Date: Fri, 27 Nov 2020 20:20:51 +0100 Message-Id: <20201127192051.1430-1-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:lWorqsxpAegYMv42EWAGou4VXMWq2jeLtSdLq2ZTmDI6syKzKM4 JxPRHWZVYtXZcQAOl6Cvm0R7FduZ5lDyIVjtBGp/m/o9oJhKX2tOk8S8vkErwBDX7jkn2Ci vGzW4VbnKaQqOd0JTTI1kERCD/GYa6NEsWIBJWt0i/uT9r4N5lDX/Ju8R8VnK+0ZNBzmioM OXNdOQZnwGs8LhgcmkG1w== X-UI-Out-Filterresults: notjunk:1;V03:K0:NzH4fWBJMG4=:Z+VSTbLmTHVlcLW+Mms6vY HU4y3gqHEGnmDF7jilRgKeIxowGf8hTzVQ+Nmwn5mBh00etGLwL76Njb2bTV/mDoRsWOX0Y8m 4CImNrvw0FVqGK0K07XJ28h/kNbXuemxOIrfzncIgrHQRX/sW7wpYctCxCk/C8WmeGO25ofUV l+JipbPrjPuDN9Mle2Gz1C+E3mAMXjLtIHx7BrsH94mZ6p29KwIcmm7cPVRvR7MifIKBtI7j3 5hH0CUXUn/eAHC1I20Rn767nyKi18k3Y7xzuMgmInTDcVJJvvuTw1CsIBAxnebSL1BFR3Q15P nyn65JbVAIJAtwkCquxFzcwmGuOOEID5p/lNrweMcfoSIs3iolIYj9GEo2JTby2+Qm8v7JSMk HnenlRP0zGygEcyh5fmIx42PVgMWRarIGX5C0RcG5s2OC/UCUl7sd8joRWhSKAxRpwiwUKspz 1iEwI/FzEe2iJi+/u01lS+DMpId/yMBkWd4j2u/5nUWVBIfEkjtunRDFS93RETEL26vUW8fiU ixcW7pHw36XrfPzyr726khFh9dw34mv7f8qQkkDDkgEj348Q21mpjPgl/8bf85hClfGLQSIQR RTvQKYSVX4VmG8DxyxJskgign7npSQSuEyU5KPt0oqhE6ZuEr42WJDd8cVNJ64UXMxT4pRqEt vgNbfNMyhKThD2gNuFGLGy+mMcvSRF8pBFp2BJ5u/XiaOn543UGYdpExBrlwc+Dn56y/kUnT3 GVTWq2EI7ZkcqknDHSX4+eJwQSDrgvD/sn3KRIHlCynFE47jIGn0kOo6mUt1FEepxxQHZhOEF aaSg3m1pWTgxd5HXn+UeSBlgK6J4V0tpzpZZhw4dfexLEnIKbNpavjR20RQ75lH+rdkecr4Ht Td6Q3ESvP+3H6YfLahmw== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since the UEFI 2.8A specification the UEFI enabled firmware provides a configuration table EFI_RT_PROPERTIES_TABLE which indicates which runtime services are enabled. The EFI stub reads this table and saves the value of the field RuntimeServicesSupported internally. The Firmware Test Suite requires the value to determine if UEFI runtime services are correctly implemented. With this patch an IOCTL call is provided to read the value of the field RuntimeServicesSupported, e.g. #define EFI_RUNTIME_GET_SUPPORTED_MASK \ _IOR('p', 0x0C, unsigned int) unsigned int mask; fd =3D open("/dev/efi_test", O_RDWR); ret =3D ioctl(fd, EFI_RUNTIME_GET_SUPPORTED_MASK, &mask); Signed-off-by: Heinrich Schuchardt =2D-- drivers/firmware/efi/test/efi_test.c | 16 ++++++++++++++++ drivers/firmware/efi/test/efi_test.h | 3 +++ 2 files changed, 19 insertions(+) diff --git a/drivers/firmware/efi/test/efi_test.c b/drivers/firmware/efi/t= est/efi_test.c index ddf9eae396fe..47d67bb0a516 100644 =2D-- a/drivers/firmware/efi/test/efi_test.c +++ b/drivers/firmware/efi/test/efi_test.c @@ -663,6 +663,19 @@ static long efi_runtime_query_capsulecaps(unsigned lo= ng arg) return rv; } +static long efi_runtime_get_supported_mask(unsigned long arg) +{ + unsigned int __user *supported_mask; + int rv =3D 0; + + supported_mask =3D (unsigned int *)arg; + + if (put_user(efi.runtime_supported_mask, supported_mask)) + rv =3D -EFAULT; + + return rv; +} + static long efi_test_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { @@ -699,6 +712,9 @@ static long efi_test_ioctl(struct file *file, unsigned= int cmd, case EFI_RUNTIME_RESET_SYSTEM: return efi_runtime_reset_system(arg); + + case EFI_RUNTIME_GET_SUPPORTED_MASK: + return efi_runtime_get_supported_mask(arg); } return -ENOTTY; diff --git a/drivers/firmware/efi/test/efi_test.h b/drivers/firmware/efi/t= est/efi_test.h index f2446aa1c2e3..117349e57993 100644 =2D-- a/drivers/firmware/efi/test/efi_test.h +++ b/drivers/firmware/efi/test/efi_test.h @@ -118,4 +118,7 @@ struct efi_resetsystem { #define EFI_RUNTIME_RESET_SYSTEM \ _IOW('p', 0x0B, struct efi_resetsystem) +#define EFI_RUNTIME_GET_SUPPORTED_MASK \ + _IOR('p', 0x0C, unsigned int) + #endif /* _DRIVERS_FIRMWARE_EFI_TEST_H_ */ =2D- 2.29.2