xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "Roger Pau Monné" <roger.pau@citrix.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	Andrew Cooper <andrew.cooper3@citrix.com>, Wei Liu <wl@xen.org>,
	Julien Grall <julien@xen.org>
Subject: Re: [PATCH 2/4] x86/ACPI: fix S3 wakeup vector mapping
Date: Mon, 4 Jan 2021 15:10:00 +0100	[thread overview]
Message-ID: <8c1fd6e1-2b20-a2e7-1fad-3216d4ea6b23@suse.com> (raw)
In-Reply-To: <20201229105116.hfg3mtjzsga7dia3@Air-de-Roger>

On 29.12.2020 11:51, Roger Pau Monné wrote:
> On Mon, Nov 23, 2020 at 01:40:12PM +0100, Jan Beulich wrote:
>> Use of __acpi_map_table() here was at least close to an abuse already
>> before, but it will now consistently return NULL here. Drop the layering
>> violation and use set_fixmap() directly. Re-use of the ACPI fixmap area
>> is hopefully going to remain "fine" for the time being.
>>
>> Add checks to acpi_enter_sleep(): The vector now needs to be contained
>> within a single page, but the ACPI spec requires 64-byte alignment of
>> FACS anyway. Also bail if no wakeup vector was determined in the first
>> place, in part as preparation for a subsequent relaxation change.
>>
>> Fixes: 1c4aa69ca1e1 ("xen/acpi: Rework acpi_os_map_memory() and acpi_os_unmap_memory()")
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Acked-by: Roger Pau Monné <roger.pau@citrix.com>

Thanks.

> See below for a comment.

For this please also note ...

>> --- a/xen/arch/x86/acpi/boot.c
>> +++ b/xen/arch/x86/acpi/boot.c
>> @@ -443,6 +443,11 @@ acpi_fadt_parse_sleep_info(struct acpi_t
>>  			"FACS is shorter than ACPI spec allow: %#x",
>>  			facs->length);
>>  
>> +	if (facs_pa % 64)
>> +		printk(KERN_WARNING PREFIX
>> +			"FACS is not 64-byte aligned: %#lx",
>> +			facs_pa);
>> +
>>  	acpi_sinfo.wakeup_vector = facs_pa + 
>>  		offsetof(struct acpi_table_facs, firmware_waking_vector);
>>  	acpi_sinfo.vector_width = 32;

... the printk() getting added here. Violation of the spec here
implies entering S3 may fail because of ...

>> @@ -331,6 +334,12 @@ static long enter_state_helper(void *dat
>>   */
>>  int acpi_enter_sleep(struct xenpf_enter_acpi_sleep *sleep)
>>  {
>> +    if ( sleep->sleep_state == ACPI_STATE_S3 &&
>> +         (!acpi_sinfo.wakeup_vector || !acpi_sinfo.vector_width ||
>> +          (PAGE_OFFSET(acpi_sinfo.wakeup_vector) >
>> +           PAGE_SIZE - acpi_sinfo.vector_width / 8)) )
> 
> Shouldn't this last check better be done in acpi_fadt_parse_sleep_info
> and then avoid setting wakeup_vector in the first place?

... the check you talk about here, albeit these are independent
aspects: The spec requires even more strict alignment, and what
gets checked here is merely a precondition for the specific
implementation of ours, not tolerating the storage for the
vector to cross a page boundary. As such, I consider it more
appropriate for the check to live here, but yes, it could in
principle also be put there.

Jan


  reply	other threads:[~2021-01-04 14:10 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-23 12:38 [PATCH 0/4] x86: ACPI and DMI table mapping fixes Jan Beulich
2020-11-23 12:39 ` [PATCH 1/4] x86/ACPI: fix mapping of FACS Jan Beulich
2020-11-23 14:30   ` Roger Pau Monné
2020-12-29 10:56   ` Roger Pau Monné
2021-01-04 13:18     ` Jan Beulich
2020-11-23 12:40 ` [PATCH 2/4] x86/ACPI: fix S3 wakeup vector mapping Jan Beulich
2020-11-23 15:24   ` Roger Pau Monné
2020-11-23 15:30     ` Jan Beulich
2020-11-23 16:07       ` Roger Pau Monné
2020-11-23 16:14         ` Andrew Cooper
2020-11-24 11:04           ` Jan Beulich
2020-11-30 13:02             ` Jan Beulich
2020-12-23 15:09               ` Ping: " Jan Beulich
2020-12-29 10:54                 ` Roger Pau Monné
2021-01-04 14:03                   ` Jan Beulich
2021-01-04 15:13                     ` Roger Pau Monné
2020-12-29 10:51   ` Roger Pau Monné
2021-01-04 14:10     ` Jan Beulich [this message]
2020-11-23 12:40 ` [PATCH 3/4] x86/DMI: fix table mapping when one lives above 1Mb Jan Beulich
2020-11-23 15:41   ` Roger Pau Monné
2020-11-23 12:41 ` [PATCH 4/4] x86/ACPI: don't invalidate S5 data when S3 wakeup vector cannot be determined Jan Beulich
2020-11-23 15:44   ` Roger Pau Monné

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=8c1fd6e1-2b20-a2e7-1fad-3216d4ea6b23@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=julien@xen.org \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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).