linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chen Yu <yu.c.chen@intel.com>
To: linux-acpi@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Ard Biesheuvel <ardb@kernel.org>, Len Brown <lenb@kernel.org>,
	Ashok Raj <ashok.raj@intel.com>,
	Andy Shevchenko <andriy.shevchenko@intel.com>,
	Mike Rapoport <rppt@kernel.org>,
	linux-kernel@vger.kernel.org, Hongyu Ning <hongyu.ning@intel.com>
Subject: Re: [PATCH v12 2/4] drivers/acpi: Introduce Platform Firmware Runtime Update device driver
Date: Mon, 20 Dec 2021 17:52:40 +0800	[thread overview]
Message-ID: <20211220095240.GA582440@chenyu-desktop> (raw)
In-Reply-To: <11441d3b36608e0840c46eb45e6d75ffc1c020ec.1639669829.git.yu.c.chen@intel.com>

On Fri, Dec 17, 2021 at 12:03:02AM +0800, Chen Yu wrote:
> Introduce the pfr_update driver which can be used for Platform Firmware
> Runtime code injection and driver update [1]. The user is expected to
> provide the EFI capsule, and pass it to the driver by writing the capsule
> to a device special file. The capsule is transferred by the driver to the
> platform firmware with the help of an ACPI _DSM method under the special
> ACPI Platform Firmware Runtime Update device (INTC1080), and the actual
> firmware update is carried out by the low-level Management Mode code in
> the platform firmware.
> 
> This patch allows certain pieces of the platform firmware to be
> updated on the fly while the system is running (runtime) without the
> need to restart it, which is key in the cases when the system needs to
> be available 100% of the time and it cannot afford the downtime related
> to restarting it, or when the work carried out by the system is
> particularly important, so it cannot be interrupted, and it is not
> practical to wait until it is complete.
> 
> Link: https://uefi.org/sites/default/files/resources/Intel_MM_OS_Interface_Spec_Rev100.pdf # [1]
> Cc: Andy Shevchenko <andriy.shevchenko@intel.com>
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Cc: Ashok Raj <ashok.raj@intel.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Len Brown <lenb@kernel.org>
> Cc: Mike Rapoport <rppt@kernel.org>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Signed-off-by: Chen Yu <yu.c.chen@intel.com>
> +
[cut]
> +static int start_update(int action, struct pfru_device *pfru_dev)
> +{
> +	union acpi_object *out_obj, in_obj, in_buf;
> +	struct pfru_updated_result update_result;
> +	acpi_handle handle;
> +	int ret = -EINVAL;
> +
> +	memset(&in_obj, 0, sizeof(in_obj));
> +	memset(&in_buf, 0, sizeof(in_buf));
> +	in_obj.type = ACPI_TYPE_PACKAGE;
> +	in_obj.package.count = 1;
> +	in_obj.package.elements = &in_buf;
> +	in_buf.type = ACPI_TYPE_INTEGER;
> +	in_buf.integer.value = action;
> +
> +	handle = ACPI_HANDLE(pfru_dev->parent_dev);
> +	out_obj = acpi_evaluate_dsm_typed(handle, &pfru_guid,
> +					  pfru_dev->rev_id, PFRU_FUNC_START,
> +					  &in_obj, ACPI_TYPE_PACKAGE);
> +	if (!out_obj)
> +		return ret;
> +
> +	if (out_obj->package.count < UPDATE_NR_IDX ||
> +	    out_obj->package.elements[UPDATE_STATUS_IDX].type != ACPI_TYPE_INTEGER ||
> +	    out_obj->package.elements[UPDATE_EXT_STATUS_IDX].type != ACPI_TYPE_INTEGER ||
> +	    out_obj->package.elements[UPDATE_AUTH_TIME_LOW_IDX].type != ACPI_TYPE_INTEGER ||
> +	    out_obj->package.elements[UPDATE_AUTH_TIME_HI_IDX].type != ACPI_TYPE_INTEGER ||
> +	    out_obj->package.elements[UPDATE_EXEC_TIME_LOW_IDX].type != ACPI_TYPE_INTEGER ||
> +	    out_obj->package.elements[UPDATE_EXEC_TIME_HI_IDX].type != ACPI_TYPE_INTEGER)
> +		goto free_acpi_buffer;
> +
> +	update_result.status =
> +		out_obj->package.elements[UPDATE_STATUS_IDX].integer.value;
Thanks for Hongyu's testing, the status should be cascaded to user space.
Will fix it in next version.

Thanks,
Chenyu

  reply	other threads:[~2021-12-20  9:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-16 16:00 [PATCH v12 0/4] Introduce Platform Firmware Runtime Update and Telemetry drivers Chen Yu
2021-12-16 16:02 ` [PATCH v12 1/4] efi: Introduce EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER and corresponding structures Chen Yu
2021-12-16 16:03 ` [PATCH v12 2/4] drivers/acpi: Introduce Platform Firmware Runtime Update device driver Chen Yu
2021-12-20  9:52   ` Chen Yu [this message]
2021-12-16 16:03 ` [PATCH v12 3/4] drivers/acpi: Introduce Platform Firmware Runtime Telemetry Chen Yu
2021-12-16 16:04 ` [PATCH v12 4/4] tools: Introduce power/acpi/tools/pfrut 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=20211220095240.GA582440@chenyu-desktop \
    --to=yu.c.chen@intel.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=ardb@kernel.org \
    --cc=ashok.raj@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hongyu.ning@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rppt@kernel.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).