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=-17.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 76976C433E0 for ; Mon, 4 Jan 2021 14:10:24 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1FF1F20770 for ; Mon, 4 Jan 2021 14:10:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1FF1F20770 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.61237.107563 (Exim 4.92) (envelope-from ) id 1kwQYW-0005Oz-4O; Mon, 04 Jan 2021 14:09:56 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 61237.107563; Mon, 04 Jan 2021 14:09:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kwQYW-0005Os-10; Mon, 04 Jan 2021 14:09:56 +0000 Received: by outflank-mailman (input) for mailman id 61237; Mon, 04 Jan 2021 14:09:55 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kwQYU-0005On-VJ for xen-devel@lists.xenproject.org; Mon, 04 Jan 2021 14:09:54 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 1149988e-44e5-4242-9154-06df4fb82273; Mon, 04 Jan 2021 14:09:52 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 95E3AACAF; Mon, 4 Jan 2021 14:09:51 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 1149988e-44e5-4242-9154-06df4fb82273 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1609769391; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bblBJJU4wiQUE7NbSJHa9CfvQGx3US1F0oUT9+sLo3E=; b=KbL2N1HBWpFjvfccP4jxsMDWKwHyQiXFg7Js7YnnUl6tScLWV+05PWhWnINTs0j2S6Pwpo MDru6lKoDOAnQ0IEQQXADhzigmIgrXMKRXiz30sovAna+3QzgdI6rC6Ct9rvoIYUg+X39c gv8M6dHof/3g15/iAcQmJDGQXqy/g3g= Subject: Re: [PATCH 2/4] x86/ACPI: fix S3 wakeup vector mapping To: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Cc: "xen-devel@lists.xenproject.org" , Andrew Cooper , Wei Liu , Julien Grall References: <7f895b0e-f46f-8fe2-b0ac-e0503ef06a1f@suse.com> <20201229105116.hfg3mtjzsga7dia3@Air-de-Roger> From: Jan Beulich Message-ID: <8c1fd6e1-2b20-a2e7-1fad-3216d4ea6b23@suse.com> Date: Mon, 4 Jan 2021 15:10:00 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20201229105116.hfg3mtjzsga7dia3@Air-de-Roger> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit 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 > > Acked-by: Roger Pau Monné 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