linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chen Yu <yu.c.chen@intel.com>
To: Shuah Khan <skhan@linuxfoundation.org>
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Len Brown <len.brown@intel.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Andy Shevchenko <andriy.shevchenko@intel.com>,
	Aubrey Li <aubrey.li@intel.com>, Ashok Raj <ashok.raj@intel.com>,
	Shuah Khan <shuah@kernel.org>,
	linux-kselftest@vger.kernel.org,
	Dou Shengnan <shengnanx.dou@intel.com>
Subject: Re: [PATCH 5/5][RFC] selftests/pfru: add test for Platform Firmware Runtime Update and Telemetry
Date: Tue, 14 Sep 2021 14:46:49 +0800	[thread overview]
Message-ID: <20210914064649.GA79693@chenyu-desktop> (raw)
In-Reply-To: <82889db2-1927-582d-c27f-b1f0927ca903@linuxfoundation.org>

Hi Shuah, thank you for taking a look at this,
On Tue, Sep 07, 2021 at 03:28:52PM -0600, Shuah Khan wrote:
> 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?
Currently the code does not distinguish between root and non-root. The
next version will terminate if the user is non-root.
> What happens when the pfru device doesn't exist?
> 
Currently the code terminates if either pfru_update or pfru_telemetry
device was not found.
> 
> [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.
> 
Okay, got it. The next version will do the following to fix this:
1. If the pfru_update device is not found, the test will terminate.
   This is because the pfru_update driver is the fundamental driver.
   If this driver is not detected, there would be no information at all.
2. If the pfru_telemetry device is not found, the test will skip
   the log setting/retrieving. Since the pfru_telemetry driver
   is optional, the user can still update the firmware without
   checking the telemetry log.

Thanks,
Chenyu 

  reply	other threads:[~2021-09-14  6:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1631025237.git.yu.c.chen@intel.com>
2021-09-07 15:40 ` [PATCH 5/5][RFC] selftests/pfru: add test for Platform Firmware Runtime Update and Telemetry Chen Yu
2021-09-07 21:28   ` Shuah Khan
2021-09-14  6:46     ` Chen Yu [this message]
2021-09-08  9:08   ` Mike Rapoport
2021-09-14  7:08     ` Chen Yu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210914064649.GA79693@chenyu-desktop \
    --to=yu.c.chen@intel.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=ashok.raj@intel.com \
    --cc=aubrey.li@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=shengnanx.dou@intel.com \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).