Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3344359pxu; Mon, 30 Nov 2020 00:22:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJzwlGBTeI7SonrIdp9xi+RFp4jqSnacAJh4c8xHq7LyQ03wjYtCuFeHBlDvTVv4X7v7/ZPa X-Received: by 2002:aa7:c712:: with SMTP id i18mr5161277edq.357.1606724560685; Mon, 30 Nov 2020 00:22:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606724560; cv=none; d=google.com; s=arc-20160816; b=wzns0U8GxF0OdwpO43L+30CGgzvbhXCZjV8Yo5pIUQhvJ02aUgUrAKwY16Lwt39noA XDoOHhmeusXmVRIQBgJNiVMfO4RzaArQdB1u1Sbm5alqd6+KL/9hcxraFf+D2P47Lwjl Hk8/Fw05EzHYz4TK0L6aUlyNSPstGQQf23ovyZcCod/SHCY9PhPxn6sQvyvF/fhY8ANt Z8C7N27cBd8W6y9/l/bZw87qw21Zgs5D78a0JafTxkEAZ8c1L0LWkprsCZftMqFZqGll 4P3cXiMlPvoDuWw6KXvPn1YCwJtJY6ysibFw+QE4BGaPR0CH8iZFTGO0vqii88hOqsjC /jIw== 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=WsRFmJzMFzPtdOXpQn57vRHxq2eQkhaDrDRA+RmbLaQ=; b=D7nI/D4CRQxHT94HkrxZLUMPUF2Vnf/WJ5j9eiFU0QaUZFfGh16vLrM4wtNh/XIkI/ 6e1smrBYU+9LnJrf1ghw0K7ZQAbC+udXAEx0ktZe1rIgtdgHvP1uPw1qSKvGe1QOq5TB ndmGLHECnd+dEbw/tjq6IXGd6sQW7rz6cTAjn3+NZoYvgTp4opbZD1dueIECPDDHZsz9 fi1IdcIowV70rKfIn6ouQlqoF8cFolNOcx/CfHVeMgTIS7eBD0A+vQGjwgAlqu7tQVUx m5dxbwqG9hJfCOxsvGCXAudzT11jmsQX+S/Nt8qRtFEpiBEehQEnLZlx68wHUzw3Vw5+ Tprg== 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 rk28si10212836ejb.711.2020.11.30.00.22.17; Mon, 30 Nov 2020 00:22:40 -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 S1726762AbgK3IQz (ORCPT + 99 others); Mon, 30 Nov 2020 03:16:55 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:35661 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725880AbgK3IQz (ORCPT ); Mon, 30 Nov 2020 03:16:55 -0500 Received: from [106.104.74.151] (helo=[192.168.31.192]) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kjeM0-00060T-PG; Mon, 30 Nov 2020 08:16:13 +0000 Subject: Re: [PATCH 1/1] efi/efi_test: read RuntimeServicesSupported To: Heinrich Schuchardt , Ard Biesheuvel Cc: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Colin King , fwts-devel@lists.ubuntu.com References: <20201127192051.1430-1-xypron.glpk@gmx.de> From: ivanhu Message-ID: <1fbab8b3-3a37-f3f5-39b4-0c8123d27b29@canonical.com> Date: Mon, 30 Nov 2020 16:16:07 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201127192051.1430-1-xypron.glpk@gmx.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Heinrich, Thanks for the patch. It looks good to me, but I noticed that the runtime_supported_mask was introduced after 5.7-rc1. Maybe we should add the kernel version checking for the old kernels. Cheers, Ivan On 11/28/20 3:20 AM, 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 >