[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/4] x86/ACPI: fix S3 wakeup vector mapping


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Mon, 23 Nov 2020 16:24:54 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jqa7ZKI8l4naPhLwRnvT0E+Zu0CVzlLTZRP53nFoKpE=; b=j7VlZDWEPebLOpNiixQ5BTnZQp44aOKMSwxFHbIWVrC5quXmoA/QdmnI//klQLZl1SQ/n2OrXmDi/2OVnlErvjpKXPZr7BzcjhIKYklsv3jC6bzapFPNtLtQ47SuEKjsuA4ekfurLjgMJPeIra+CyOLqPrhLpm3pCyKs2CioJHHgynsq9OgHryLnjHykOzvt6JqkajeFH6DI3gai3C83A98Zyu7PkZ4Q2/nbfoEdQfZ0duBPOTbr5csGLxc6YNKCy11YQwzNjie1ldmKMjDgm8WkJjE3IWMJAtcT3vOOSFxBDpHgeFa49lNa4hKCaiYbU+UppPC/Ao4+X/NlQp5X+Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UJ8sJQrgAFeNoUz2h/seYIafOurN4TyFZLWZi6o1Nwwl55MBe6VirYox4MI1eOvwVfcQ6mobrbV+sk2J0agOonC50k/0pIZXlCZkwGi6qERXZxZT1WRNByubtBsh5yLmyGMpgNa7BocI5pRSD8UOI6sgXSOLIF/MH+8EEYbOVoyv9DoMTiBBlmWxsey1R2CfaHGXX85xTWrYeDVzi+Cw8NlakPcnCJUwda9k8iu/nxRcJftCwZOCyKqkSMP+gTfLuljQE28lVsLh9IKQx0eGMBTRyNAYvfncDyuSe7VC+CW/rzhs+3p3l4y7hRk1xbmsFJyE4NPQSaqvs/5yYWymgg==
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Julien Grall <julien@xxxxxxx>
  • Delivery-date: Mon, 23 Nov 2020 15:25:04 +0000
  • Ironport-sdr: BrZe3/oKhLRGhrzpF7iAOMaLLlpsXVbDtuzsJ08pyHEWqTgvtCpQFH83+p1s6fVhN8ZOqk9Hc9 8cWuxBFl8OaMvA+v5xOMiYW6+nOWZgtBRSNMZuaPK6s2XdUGvSyCiEtKLHZGnnPGXwvdltZYRr VcQ40IhLSESWvU1IFBG5o7rG1CDfBJ3DvoHkM5NfhaDhBTdpddaCgTpwc8G/rBFFxQxv+4nABZ vT/hCDlsdDqW5v7vyEAXH+2murT6iVpLZN/Eq3DxiPsiZQJsSFUxqjV8TIVGrYGslWvBiRbcJD ruk=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxxx>
> 
> --- 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;
> --- a/xen/arch/x86/acpi/power.c
> +++ b/xen/arch/x86/acpi/power.c
> @@ -174,17 +174,20 @@ static void acpi_sleep_prepare(u32 state
>      if ( state != ACPI_STATE_S3 )
>          return;
>  
> -    wakeup_vector_va = __acpi_map_table(
> -        acpi_sinfo.wakeup_vector, sizeof(uint64_t));
> -
>      /* TBoot will set resume vector itself (when it is safe to do so). */
>      if ( tboot_in_measured_env() )
>          return;
>  
> +    set_fixmap(FIX_ACPI_END, acpi_sinfo.wakeup_vector);
> +    wakeup_vector_va = fix_to_virt(FIX_ACPI_END) +
> +                       PAGE_OFFSET(acpi_sinfo.wakeup_vector);
> +
>      if ( acpi_sinfo.vector_width == 32 )
>          *(uint32_t *)wakeup_vector_va = bootsym_phys(wakeup_start);
>      else
>          *(uint64_t *)wakeup_vector_va = bootsym_phys(wakeup_start);
> +
> +    clear_fixmap(FIX_ACPI_END);

Why not use vmap here instead of the fixmap?

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.