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=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 4F3A3C433FE for ; Tue, 7 Sep 2021 21:29:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 281E261106 for ; Tue, 7 Sep 2021 21:29:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350538AbhIGVbD (ORCPT ); Tue, 7 Sep 2021 17:31:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348681AbhIGVaF (ORCPT ); Tue, 7 Sep 2021 17:30:05 -0400 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4725C06175F for ; Tue, 7 Sep 2021 14:28:54 -0700 (PDT) Received: by mail-io1-xd34.google.com with SMTP id g9so362727ioq.11 for ; Tue, 07 Sep 2021 14:28:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=uQ1QKlOMUxMJjspXpCNHZjX329YTQj9Uc23PyYscxxE=; b=FbO+pDJXDBkBjC1rlKAdQfQgfh08Xa3kp6kg4kr7w0Y5RfqJlJsZJaWhpbBQz8nQqc keSp3KjF48yyjtGYzivaNDwdC5pmNPDMlXgcahzEhY/BtqEdJRNRPSFOYLUsZ498FeFY NucFj/hNQX432SYJKtlG1bl88o+Q4HvaC23zc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=uQ1QKlOMUxMJjspXpCNHZjX329YTQj9Uc23PyYscxxE=; b=dU0n9w2UiKccplJdMAX0p8kq+9VO7RAGct70tb3xqRlvtn1uXaysYq0qbx1W4M3gJU qLpQkYiBdBIbVekJFYilk+S5j5lz6GLugbGroVaXxxZ3FeW1EBuoGZhBxlGItXOEjeFl sOVYvvRSpKEOH7wBLIcZnhKDiRu2LT+hCYbpVOhCoOd8tu0o8GjTX/yZWx8sal2XZTtm UyojUWbaM5JgCvZnGlbhmh2h1iT3/ISmumZ9YxmWfSSjOOLbKACLQ7mDsqE1LZaQqdP6 QrlOT74kutmQC8gu6IVO7FDhpEAb1hE3mSeOwARyetZVUSNdQX8DoyWKGY+tiEaixV97 DyEg== X-Gm-Message-State: AOAM530Uz9e9BmnDjS5ePEGk3nZ5JCKtbwpZflywp6gGNwjuQRW7lFyo FdJh4qUTUoILnxK71CKwgpCB2wNQW8iWdw== X-Google-Smtp-Source: ABdhPJzq6xHc9ICyXPhNWoqmW3TFqPqfpQwhKPYhzkwAjJos1JLP7WLlq4mXoHgNUL0MH3n/iMByWw== X-Received: by 2002:a05:6638:4104:: with SMTP id ay4mr397781jab.10.1631050134251; Tue, 07 Sep 2021 14:28:54 -0700 (PDT) Received: from [192.168.1.112] (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id m13sm140087ilh.43.2021.09.07.14.28.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Sep 2021 14:28:53 -0700 (PDT) Subject: Re: [PATCH 5/5][RFC] selftests/pfru: add test for Platform Firmware Runtime Update and Telemetry To: Chen Yu , linux-acpi@vger.kernel.org Cc: linux-kernel@vger.kernel.org, "Rafael J. Wysocki" , Len Brown , Dan Williams , Andy Shevchenko , Aubrey Li , Ashok Raj , Shuah Khan , linux-kselftest@vger.kernel.org, Dou Shengnan , Shuah Khan References: <1cef405de3484eef108251562fbf461bad4294c7.1631025237.git.yu.c.chen@intel.com> From: Shuah Khan Message-ID: <82889db2-1927-582d-c27f-b1f0927ca903@linuxfoundation.org> Date: Tue, 7 Sep 2021 15:28:52 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <1cef405de3484eef108251562fbf461bad4294c7.1631025237.git.yu.c.chen@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/7/21 9:40 AM, Chen Yu wrote: > Introduce a simple test for Platform Firmware Runtime Update and Telemetry > drivers. It is based on ioctl to either update firmware driver or code injection, > and read corresponding PFRU Telemetry log into user space. > A few things to consider and add handling for them in the test. What happens when non-root user runs this test? What happens when the pfru device doesn't exist? [snip] > +} > + > +int main(int argc, char *argv[]) > +{ > + int fd_update, fd_log, fd_capsule; > + struct telem_data_info data_info; > + struct telem_info info; > + struct update_cap_info cap; > + void *addr_map_capsule; > + struct stat st; > + char *log_buf; > + int ret = 0; > + > + parse_options(argc, argv); > + > + fd_log = open("/dev/pfru/telemetry", O_RDWR); > + if (fd_log < 0) { > + perror("Cannot open telemetry device..."); > + return 1; > + } Is this considered an error or unsupported? > + fd_update = open("/dev/pfru/update", O_RDWR); > + if (fd_update < 0) { > + perror("Cannot open code injection device..."); > + return 1; > + } > + Same here. If test is run on platform with pfru test should skip instead of reporting failure/error. thanks, -- Shuah