Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1848433pxu; Fri, 27 Nov 2020 17:28:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJxt8/Wd2jDezgPYiIsKnBnzGp8yNP3dIyCae76XEueClWnPskREfBpUVKqbYeq3tZwTvPdb X-Received: by 2002:a17:906:4c82:: with SMTP id q2mr10346023eju.285.1606526927747; Fri, 27 Nov 2020 17:28:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606526927; cv=none; d=google.com; s=arc-20160816; b=nwSjWeGHS5UGFMW5lbyWM2uDFdROlVH8wI52pyQazKvMuuNkyEBQgSakafR8zck2/m RpSlVE7SJFfhiQk7njdb5vsGZGMvhnzPh8Fl7x3gIzASt/NlfGHKncvV4rwrJ76C824A PP8euWTlY5KxFjqiCl6hs3IBPjo02/0TkRWyp4pVEun5fZpYuGQTC/y8hboTIFPvXFPE 0xIbCuDQzjH9XYKrYeuyjy/FDW6209I2t8BNf3+PI774XNFreaCMQLdvENPHNCaAm0gk xkf3o+zqXtKD0OjOCJDRdS97qi1T8z+szX17dpIXXIJGUQlDp7ykeFPBQ3izcQqpHlqK rIWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=4/1vyeUv4zGIf8CxIt2bbh9AJbo3o/cGAR7dNWKFJmo=; b=tXTKkYTaMTOUWP+ym7ETNXG65b8V2hCdvN9VjCuzcvrYTUgz/hV1rL46H5Aw31+wjC VqXFSW/pQNqDh1b/7eIX/6JyttU02pP9IsIfvjpQwAtM+MKU2OL4ZIFlvD+fePu3QtlX 0yvQMvaBK3anibHURqHHuuj8UnZ26rxDMcRa+K1A6/gHDm4q0t/WuMUw+05+pF34RSjY GfnfaRlSQBuFpBSr5jDwFVPVYsAflMsgFU5TE92GzMvDt1iJp+sX4CVuhPbYgytHwl00 5NmNhraVy/FTTuih1aNrBhU/GUzAbv8GdX/lmcsYl7XTZTFTBhc1TBa6Cf2YZ5jaxO4d mZng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v5si6284551eda.107.2020.11.27.17.28.25; Fri, 27 Nov 2020 17:28:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730098AbgK1BYA (ORCPT + 99 others); Fri, 27 Nov 2020 20:24:00 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:57378 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731210AbgK0UA5 (ORCPT ); Fri, 27 Nov 2020 15:00:57 -0500 Received: from 1.general.cking.uk.vpn ([10.172.193.212]) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kijZN-0004ws-Tl; Fri, 27 Nov 2020 19:38:13 +0000 Subject: Re: ACK: [PATCH 1/1] efi/efi_test: read RuntimeServicesSupported To: Ard Biesheuvel Cc: Heinrich Schuchardt , Ivan Hu , linux-efi , Linux Kernel Mailing List , fwts-devel@lists.ubuntu.com References: <20201127192051.1430-1-xypron.glpk@gmx.de> <98faddb2-5acc-c228-d002-71341d1c558e@canonical.com> From: Colin Ian King Message-ID: <8d4133d9-3d4b-ee3c-7bb0-927c14d37961@canonical.com> Date: Fri, 27 Nov 2020 19:38:13 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27/11/2020 19:29, Ard Biesheuvel wrote: > On Fri, 27 Nov 2020 at 20:28, Colin Ian King wrote: >> >> On 27/11/2020 19:20, Heinrich Schuchardt wrote: >>> 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 = open("/dev/efi_test", O_RDWR); >>> ret = ioctl(fd, EFI_RUNTIME_GET_SUPPORTED_MASK, &mask); >>> >>> Signed-off-by: Heinrich Schuchardt >>> --- >>> 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/test/efi_test.c >>> index ddf9eae396fe..47d67bb0a516 100644 >>> --- 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 long arg) >>> return rv; >>> } >>> >>> +static long efi_runtime_get_supported_mask(unsigned long arg) >>> +{ >>> + unsigned int __user *supported_mask; >>> + int rv = 0; >>> + >>> + supported_mask = (unsigned int *)arg; >>> + >>> + if (put_user(efi.runtime_supported_mask, supported_mask)) >>> + rv = -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/test/efi_test.h >>> index f2446aa1c2e3..117349e57993 100644 >>> --- 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_ */ >>> -- >>> 2.29.2 >>> >> >> Looks good to me. Thanks Heinrich. >> >> The EFI driver needs to be also updated in the linux kernel - has that >> fix been submitted or do you require the fwts team to do that? Oops. It's been a lot week :-( >> > > This /is/ the EFI driver. > > I'll take this as an acked-by but I'd like Ivan to chime in as well. > +1