From nobody Sun May 5 18:27:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1603467749; cv=none; d=zohomail.com; s=zohoarc; b=M/rf4tCNcxZTgzEhb4v4u/JayxBUx2rR1yCNH6qgmmZv0LsAAqYepPjMu8mbprFezuiuAuNzpgZ3sIi5ZvmfmulnaC6uUXdhYnf9IVRlOKUdbi7YrVSMfZG3Ej5VKjX4Gu1NrU+nqCw1yAE/U8BqdTVNa4oSFMAmobE0igFKcS8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603467749; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=5sAqH1p7E9o/e3huPMn1JHSLfgrcyUzmCSK/8SVUy1U=; b=E4YBjt279bmJkCixS5rAexxwa2pN7LX8qUeyT17xUx5Fw+BHRePGlU+zVva1R8wCyEqLO5nOTw3Gjrx0S6LILKNEi5jqMQPbf8cphaYibnsnHQ36F7SOA2478UpUqy7fvK5kRK06JI7fla75IirUTiIMRSSlEqsuRaLQJol3f18= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 160346774930022.722944117248858; Fri, 23 Oct 2020 08:42:29 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.11090.29389 (Exim 4.92) (envelope-from ) id 1kVzCi-0001ub-N3; Fri, 23 Oct 2020 15:42:08 +0000 Received: by outflank-mailman (output) from mailman id 11090.29389; Fri, 23 Oct 2020 15:42:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCi-0001uT-JT; Fri, 23 Oct 2020 15:42:08 +0000 Received: by outflank-mailman (input) for mailman id 11090; Fri, 23 Oct 2020 15:42:06 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCg-0001tF-NH for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 15:42:06 +0000 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b82c153b-1e68-4902-b1fc-9280c714a7cb; Fri, 23 Oct 2020 15:42:05 +0000 (UTC) Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCd-0006qO-Oh; Fri, 23 Oct 2020 15:42:03 +0000 Received: from 54-240-197-235.amazon.com ([54.240.197.235] helo=ufe34d9ed68d054.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVzCd-0007wb-E2; Fri, 23 Oct 2020 15:42:03 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCg-0001tF-NH for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 15:42:06 +0000 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b82c153b-1e68-4902-b1fc-9280c714a7cb; Fri, 23 Oct 2020 15:42:05 +0000 (UTC) Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCd-0006qO-Oh; Fri, 23 Oct 2020 15:42:03 +0000 Received: from 54-240-197-235.amazon.com ([54.240.197.235] helo=ufe34d9ed68d054.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVzCd-0007wb-E2; Fri, 23 Oct 2020 15:42:03 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: b82c153b-1e68-4902-b1fc-9280c714a7cb DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=5sAqH1p7E9o/e3huPMn1JHSLfgrcyUzmCSK/8SVUy1U=; b=nwHVoFWswujMk2ZQTQyCNN4bd NuokyUNJAPDY8glIgM1ehxPo2tRO6ZlkbldJpeTiD+3Oe6kqdQ2h86fHpkARJneWsZu6P0NxBmUfW Kz63m2Irep3sVriPLjeObGK7tS0nCs3OVNUNbEWBqcVno3un9BX+8nRmToKvsqx5eN6pY=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: alex.bennee@linaro.org, masami.hiramatsu@linaro.org, ehem+xen@m5p.com, bertrand.marquis@arm.com, andre.przywara@arm.com, Rahul.Singh@arm.com, Julien Grall , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Wei Liu , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Rahul Singh Subject: [PATCH v2 1/7] xen/acpi: Rework acpi_os_map_memory() and acpi_os_unmap_memory() Date: Fri, 23 Oct 2020 16:41:50 +0100 Message-Id: <20201023154156.6593-2-julien@xen.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201023154156.6593-1-julien@xen.org> References: <20201023154156.6593-1-julien@xen.org> X-ZohoMail-DKIM: pass (identity @xen.org) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Julien Grall The functions acpi_os_{un,}map_memory() are meant to be arch-agnostic while the __acpi_os_{un,}map_memory() are meant to be arch-specific. Currently, the former are still containing x86 specific code. To avoid this rather strange split, the generic helpers are reworked so they are arch-agnostic. This requires the introduction of a new helper __acpi_os_unmap_memory() that will undo any mapping done by __acpi_os_map_memory(). Currently, the arch-helper for unmap is basically a no-op so it only returns whether the mapping was arch specific. But this will change in the future. Note that the x86 version of acpi_os_map_memory() was already able to able the 1MB region. Hence why there is no addition of new code. Signed-off-by: Julien Grall Reviewed-by: Rahul Singh Tested-by: Rahul Singh Acked-by: Stefano Stabellini Reviewed-by: Jan Beulich Tested-by: Elliott Mitchell --- Changes in v2: - Constify ptr in __acpi_unmap_table() - Coding style fixes - Fix build on arm64 - Use PAGE_OFFSET() rather than open-coding it - Add Rahul's tested-by and reviewed-by --- xen/arch/arm/acpi/lib.c | 12 ++++++++++++ xen/arch/x86/acpi/lib.c | 18 ++++++++++++++++++ xen/drivers/acpi/osl.c | 34 ++++++++++++++++++---------------- xen/include/xen/acpi.h | 1 + 4 files changed, 49 insertions(+), 16 deletions(-) diff --git a/xen/arch/arm/acpi/lib.c b/xen/arch/arm/acpi/lib.c index 4fc6e17322c1..fcc186b03399 100644 --- a/xen/arch/arm/acpi/lib.c +++ b/xen/arch/arm/acpi/lib.c @@ -30,6 +30,10 @@ char *__acpi_map_table(paddr_t phys, unsigned long size) unsigned long base, offset, mapped_size; int idx; =20 + /* No arch specific implementation after early boot */ + if ( system_state >=3D SYS_STATE_boot ) + return NULL; + offset =3D phys & (PAGE_SIZE - 1); mapped_size =3D PAGE_SIZE - offset; set_fixmap(FIXMAP_ACPI_BEGIN, maddr_to_mfn(phys), PAGE_HYPERVISOR); @@ -49,6 +53,14 @@ char *__acpi_map_table(paddr_t phys, unsigned long size) return ((char *) base + offset); } =20 +bool __acpi_unmap_table(const void *ptr, unsigned long size) +{ + vaddr_t vaddr =3D (vaddr_t)ptr; + + return ((vaddr >=3D FIXMAP_ADDR(FIXMAP_ACPI_BEGIN)) && + (vaddr < (FIXMAP_ADDR(FIXMAP_ACPI_END) + PAGE_SIZE))); +} + /* True to indicate PSCI 0.2+ is implemented */ bool __init acpi_psci_present(void) { diff --git a/xen/arch/x86/acpi/lib.c b/xen/arch/x86/acpi/lib.c index 265b9ad81905..a22414a05c13 100644 --- a/xen/arch/x86/acpi/lib.c +++ b/xen/arch/x86/acpi/lib.c @@ -46,6 +46,10 @@ char *__acpi_map_table(paddr_t phys, unsigned long size) if ((phys + size) <=3D (1 * 1024 * 1024)) return __va(phys); =20 + /* No further arch specific implementation after early boot */ + if (system_state >=3D SYS_STATE_boot) + return NULL; + offset =3D phys & (PAGE_SIZE - 1); mapped_size =3D PAGE_SIZE - offset; set_fixmap(FIX_ACPI_END, phys); @@ -66,6 +70,20 @@ char *__acpi_map_table(paddr_t phys, unsigned long size) return ((char *) base + offset); } =20 +bool __acpi_unmap_table(const void *ptr, unsigned long size) +{ + unsigned long vaddr =3D (unsigned long)ptr; + + if ((vaddr >=3D DIRECTMAP_VIRT_START) && + (vaddr < DIRECTMAP_VIRT_END)) { + ASSERT(!((__pa(ptr) + size - 1) >> 20)); + return true; + } + + return ((vaddr >=3D __fix_to_virt(FIX_ACPI_END)) && + (vaddr < (__fix_to_virt(FIX_ACPI_BEGIN) + PAGE_SIZE))); +} + unsigned int acpi_get_processor_id(unsigned int cpu) { unsigned int acpiid, apicid; diff --git a/xen/drivers/acpi/osl.c b/xen/drivers/acpi/osl.c index 4c8bb7839eda..389505f78666 100644 --- a/xen/drivers/acpi/osl.c +++ b/xen/drivers/acpi/osl.c @@ -92,27 +92,29 @@ acpi_physical_address __init acpi_os_get_root_pointer(v= oid) void __iomem * acpi_os_map_memory(acpi_physical_address phys, acpi_size size) { - if (system_state >=3D SYS_STATE_boot) { - mfn_t mfn =3D _mfn(PFN_DOWN(phys)); - unsigned int offs =3D phys & (PAGE_SIZE - 1); - - /* The low first Mb is always mapped on x86. */ - if (IS_ENABLED(CONFIG_X86) && !((phys + size - 1) >> 20)) - return __va(phys); - return __vmap(&mfn, PFN_UP(offs + size), 1, 1, - ACPI_MAP_MEM_ATTR, VMAP_DEFAULT) + offs; - } - return __acpi_map_table(phys, size); + void *ptr; + mfn_t mfn =3D _mfn(PFN_DOWN(phys)); + unsigned int offs =3D PAGE_OFFSET(phys); + + /* Try the arch specific implementation first */ + ptr =3D __acpi_map_table(phys, size); + if (ptr) + return ptr; + + /* No common implementation for early boot map */ + if (unlikely(system_state < SYS_STATE_boot)) + return NULL; + + ptr =3D __vmap(&mfn, PFN_UP(offs + size), 1, 1, + ACPI_MAP_MEM_ATTR, VMAP_DEFAULT); + + return !ptr ? NULL : (ptr + offs); } =20 void acpi_os_unmap_memory(void __iomem * virt, acpi_size size) { - if (IS_ENABLED(CONFIG_X86) && - (unsigned long)virt >=3D DIRECTMAP_VIRT_START && - (unsigned long)virt < DIRECTMAP_VIRT_END) { - ASSERT(!((__pa(virt) + size - 1) >> 20)); + if (__acpi_unmap_table(virt, size)) return; - } =20 if (system_state >=3D SYS_STATE_boot) vunmap((void *)((unsigned long)virt & PAGE_MASK)); diff --git a/xen/include/xen/acpi.h b/xen/include/xen/acpi.h index c945ab05c864..21d5e9feb5ae 100644 --- a/xen/include/xen/acpi.h +++ b/xen/include/xen/acpi.h @@ -68,6 +68,7 @@ typedef int (*acpi_table_entry_handler) (struct acpi_subt= able_header *header, co =20 unsigned int acpi_get_processor_id (unsigned int cpu); char * __acpi_map_table (paddr_t phys_addr, unsigned long size); +bool __acpi_unmap_table(const void *ptr, unsigned long size); int acpi_boot_init (void); int acpi_boot_table_init (void); int acpi_numa_init (void); --=20 2.17.1 From nobody Sun May 5 18:27:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1603467759; cv=none; d=zohomail.com; s=zohoarc; b=e/B7ItC36v6DzuONgiWqx4pC9vAAKkwfbxH+1USUNh+KVkTI/SsIwPuZLf7T7877tPZc25ygk9CfD8lBRX8/nZMhvIFSZdB3z6wxOmo5AFJWUiw6uKNtJzekN+VoFO4Es4stBo2IruyRwROca+iyUhUj2nBUa907N2131JPF5EQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603467759; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=HcZbTU8t/M6Ruiq9fikm3iT8lCruTeZsHeQARUWgYFE=; b=mZJwuO9XOZdGfjICW3hlxWNFq5Mn7JSP6JdKYi58W+DlI6iu+VPh54Gs+0PPVkMum8IACnH01B+h9VXLwaaOvpASz3NAEJlolMPveLO/8ZH7pUucFaHQfROsUQNBDeuCRjyN+RDk2myoBWfvd+KbyVbeuTyJ9H6akauN65YzFlM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1603467759565119.27293249661591; Fri, 23 Oct 2020 08:42:39 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.11095.29448 (Exim 4.92) (envelope-from ) id 1kVzCu-0002BA-Gp; Fri, 23 Oct 2020 15:42:20 +0000 Received: by outflank-mailman (output) from mailman id 11095.29448; Fri, 23 Oct 2020 15:42:20 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCu-0002B0-DW; Fri, 23 Oct 2020 15:42:20 +0000 Received: by outflank-mailman (input) for mailman id 11095; Fri, 23 Oct 2020 15:42:19 +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 1kVzCt-0001sI-10 for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 15:42:19 +0000 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id cead6ae4-bffe-432e-bbd1-a6f115e21901; Fri, 23 Oct 2020 15:42:11 +0000 (UTC) Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCf-0006qX-Qv; Fri, 23 Oct 2020 15:42:05 +0000 Received: from 54-240-197-235.amazon.com ([54.240.197.235] helo=ufe34d9ed68d054.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVzCf-0007wb-Gq; Fri, 23 Oct 2020 15:42:05 +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 1kVzCt-0001sI-10 for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 15:42:19 +0000 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id cead6ae4-bffe-432e-bbd1-a6f115e21901; Fri, 23 Oct 2020 15:42:11 +0000 (UTC) Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCf-0006qX-Qv; Fri, 23 Oct 2020 15:42:05 +0000 Received: from 54-240-197-235.amazon.com ([54.240.197.235] helo=ufe34d9ed68d054.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVzCf-0007wb-Gq; Fri, 23 Oct 2020 15:42:05 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: cead6ae4-bffe-432e-bbd1-a6f115e21901 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=HcZbTU8t/M6Ruiq9fikm3iT8lCruTeZsHeQARUWgYFE=; b=P3FpaibtAFbVLFIK8KEi1gfn0 RcJXK5ewmuL4+2tSJdS5DM8VCfs+VJw6wpYnxV81k1ZDcundBuos/SFQiEThSIljnvdY2me8xoo8j YY7YZqqQGYWkAWdKpubEnvW/lq9g3PxizhH8Gu+vu9owG5F2nrgGh6FKjsI0Y1eWk67lA=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: alex.bennee@linaro.org, masami.hiramatsu@linaro.org, ehem+xen@m5p.com, bertrand.marquis@arm.com, andre.przywara@arm.com, Rahul.Singh@arm.com, Julien Grall , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Wei Xu Subject: [PATCH v2 2/7] xen/arm: acpi: The fixmap area should always be cleared during failure/unmap Date: Fri, 23 Oct 2020 16:41:51 +0100 Message-Id: <20201023154156.6593-3-julien@xen.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201023154156.6593-1-julien@xen.org> References: <20201023154156.6593-1-julien@xen.org> X-ZohoMail-DKIM: pass (identity @xen.org) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Julien Grall Commit 022387ee1ad3 "xen/arm: mm: Don't open-code Xen PT update in {set, clear}_fixmap()" enforced that each set_fixmap() should be paired with a clear_fixmap(). Any failure to follow the model would result to a platform crash. Unfortunately, the use of fixmap in the ACPI code was overlooked as it is calling set_fixmap() but not clear_fixmap(). The function __acpi_os_map_table() is reworked so: - We know before the mapping whether the fixmap region is big enough for the mapping. - It will fail if the fixmap is already in use. This is not a change of behavior but clarifying the current expectation to avoid hitting a BUG(). The function __acpi_os_unmap_table() will now call clear_fixmap(). Reported-by: Wei Xu Signed-off-by: Julien Grall Acked-by: Stefano Stabellini Acked-by? :) Tested-by: Elliott Mitchell --- The discussion on the original thread [1] suggested to also zap it on x86. This is technically not necessary today, so it is left alone for now. I looked at making the fixmap code common but the index are inverted between Arm and x86. Changes in v2: - Clarify the commit message - Fix the size computation in __acpi_unmap_table() [1] https://lore.kernel.org/xen-devel/5E26C935.9080107@hisilicon.com/ --- xen/arch/arm/acpi/lib.c | 73 +++++++++++++++++++++++++++++++---------- 1 file changed, 56 insertions(+), 17 deletions(-) diff --git a/xen/arch/arm/acpi/lib.c b/xen/arch/arm/acpi/lib.c index fcc186b03399..b755620e67b5 100644 --- a/xen/arch/arm/acpi/lib.c +++ b/xen/arch/arm/acpi/lib.c @@ -25,40 +25,79 @@ #include #include =20 +static bool fixmap_inuse; + char *__acpi_map_table(paddr_t phys, unsigned long size) { - unsigned long base, offset, mapped_size; - int idx; + unsigned long base, offset; + mfn_t mfn; + unsigned int idx; =20 /* No arch specific implementation after early boot */ if ( system_state >=3D SYS_STATE_boot ) return NULL; =20 offset =3D phys & (PAGE_SIZE - 1); - mapped_size =3D PAGE_SIZE - offset; - set_fixmap(FIXMAP_ACPI_BEGIN, maddr_to_mfn(phys), PAGE_HYPERVISOR); - base =3D FIXMAP_ADDR(FIXMAP_ACPI_BEGIN); + base =3D FIXMAP_ADDR(FIXMAP_ACPI_BEGIN) + offset; + + /* Check the fixmap is big enough to map the region */ + if ( (FIXMAP_ADDR(FIXMAP_ACPI_END) + PAGE_SIZE - base) < size ) + return NULL; + + /* With the fixmap, we can only map one region at the time */ + if ( fixmap_inuse ) + return NULL; =20 - /* Most cases can be covered by the below. */ + fixmap_inuse =3D true; + + size +=3D offset; + mfn =3D maddr_to_mfn(phys); idx =3D FIXMAP_ACPI_BEGIN; - while ( mapped_size < size ) - { - if ( ++idx > FIXMAP_ACPI_END ) - return NULL; /* cannot handle this */ - phys +=3D PAGE_SIZE; - set_fixmap(idx, maddr_to_mfn(phys), PAGE_HYPERVISOR); - mapped_size +=3D PAGE_SIZE; - } =20 - return ((char *) base + offset); + do { + set_fixmap(idx, mfn, PAGE_HYPERVISOR); + size -=3D min(size, (unsigned long)PAGE_SIZE); + mfn =3D mfn_add(mfn, 1); + idx++; + } while ( size > 0 ); + + return (char *)base; } =20 bool __acpi_unmap_table(const void *ptr, unsigned long size) { vaddr_t vaddr =3D (vaddr_t)ptr; + unsigned int idx; + + /* We are only handling fixmap address in the arch code */ + if ( (vaddr < FIXMAP_ADDR(FIXMAP_ACPI_BEGIN)) || + (vaddr >=3D FIXMAP_ADDR(FIXMAP_ACPI_END)) ) + return false; + + /* + * __acpi_map_table() will always return a pointer in the first page + * for the ACPI fixmap region. The caller is expected to free with + * the same address. + */ + ASSERT((vaddr & PAGE_MASK) =3D=3D FIXMAP_ADDR(FIXMAP_ACPI_BEGIN)); + + /* The region allocated fit in the ACPI fixmap region. */ + ASSERT(size < (FIXMAP_ADDR(FIXMAP_ACPI_END) + PAGE_SIZE - vaddr)); + ASSERT(fixmap_inuse); + + fixmap_inuse =3D false; + + size +=3D vaddr - FIXMAP_ADDR(FIXMAP_ACPI_BEGIN); + idx =3D FIXMAP_ACPI_BEGIN; + + do + { + clear_fixmap(idx); + size -=3D min(size, (unsigned long)PAGE_SIZE); + idx++; + } while ( size > 0 ); =20 - return ((vaddr >=3D FIXMAP_ADDR(FIXMAP_ACPI_BEGIN)) && - (vaddr < (FIXMAP_ADDR(FIXMAP_ACPI_END) + PAGE_SIZE))); + return true; } =20 /* True to indicate PSCI 0.2+ is implemented */ --=20 2.17.1 From nobody Sun May 5 18:27:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1603467748; cv=none; d=zohomail.com; s=zohoarc; b=hlwmRMSGYt9DRSfcU6fgzknkRPlzJr/+zlq6+svmOQCafn4NMVvXnXqMbrceCp3cLTzdK+PNcI7skp4LujTUwLtQvZOJgoU4gGOHZGBzgUB5zFHRWjLLhVaeoY8eV8cpsVpFj8WZ2e1tqzc6IuUE/2xpW/RROC5dqSqx/eDCMJY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603467748; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=e/uuoKFzFJnK8H8UoaneqmSTwLDi27UJbrlnGwgsDCk=; b=Xwzpyk94Aareeq/kcf3UtSbYK3MvBRWsPHgQOXZ6g66/2g4majc8XtACPSB97wMGpvVCxUUDUhqGCvheZYLMzfYQJKLuLoEgJoj6VO9F4I9DBv43TRjxHbAmC5zOKx6LMjYZWQ+p85PKz7lczFJU7PsxG79tkqm3mgC8EaA14U4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1603467748451867.9143432722782; Fri, 23 Oct 2020 08:42:28 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.11091.29400 (Exim 4.92) (envelope-from ) id 1kVzCk-0001wn-68; Fri, 23 Oct 2020 15:42:10 +0000 Received: by outflank-mailman (output) from mailman id 11091.29400; Fri, 23 Oct 2020 15:42:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCk-0001wf-29; Fri, 23 Oct 2020 15:42:10 +0000 Received: by outflank-mailman (input) for mailman id 11091; Fri, 23 Oct 2020 15:42:09 +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 1kVzCj-0001sI-5x for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 15:42:09 +0000 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id f66bf689-5611-4936-a33c-af2393b9d86d; Fri, 23 Oct 2020 15:42:08 +0000 (UTC) Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCh-0006qd-V6; Fri, 23 Oct 2020 15:42:07 +0000 Received: from 54-240-197-235.amazon.com ([54.240.197.235] helo=ufe34d9ed68d054.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVzCh-0007wb-Jh; Fri, 23 Oct 2020 15:42:07 +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 1kVzCj-0001sI-5x for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 15:42:09 +0000 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id f66bf689-5611-4936-a33c-af2393b9d86d; Fri, 23 Oct 2020 15:42:08 +0000 (UTC) Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCh-0006qd-V6; Fri, 23 Oct 2020 15:42:07 +0000 Received: from 54-240-197-235.amazon.com ([54.240.197.235] helo=ufe34d9ed68d054.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVzCh-0007wb-Jh; Fri, 23 Oct 2020 15:42:07 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: f66bf689-5611-4936-a33c-af2393b9d86d DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=e/uuoKFzFJnK8H8UoaneqmSTwLDi27UJbrlnGwgsDCk=; b=qUupofu5KDc3BkRqa8wjSrCme VGN/JetlsmJm/XyhwoFx3FKBjMMF4CVaS7qMbX+igDtyJ1/Qtx/smGiIlYso7dVL/ZVnF0FeWaKtk hC2+bdOst5Pe6OJRkZu6bcee/6YS/6fwI9wel6b7V32mHs3CUEeY41z1L+nnb4qT0WUfc=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: alex.bennee@linaro.org, masami.hiramatsu@linaro.org, ehem+xen@m5p.com, bertrand.marquis@arm.com, andre.przywara@arm.com, Rahul.Singh@arm.com, Julien Grall , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Rahul Singh Subject: [PATCH v2 3/7] xen/arm: Check if the platform is not using ACPI before initializing Dom0less Date: Fri, 23 Oct 2020 16:41:52 +0100 Message-Id: <20201023154156.6593-4-julien@xen.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201023154156.6593-1-julien@xen.org> References: <20201023154156.6593-1-julien@xen.org> X-ZohoMail-DKIM: pass (identity @xen.org) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Julien Grall Dom0less requires a device-tree. However, since commit 6e3e77120378 "xen/arm: setup: Relocate the Device-Tree later on in the boot", the device-tree will not get unflatten when using ACPI. This will lead to a crash during boot. Given the complexity to setup dom0less with ACPI (for instance how to assign device?), we should skip any code related to Dom0less when using ACPI. Signed-off-by: Julien Grall Tested-by: Rahul Singh Reviewed-by: Rahul Singh Reviewed-by: Stefano Stabellini Tested-by: Elliott Mitchell --- Changes in v2: - Add Rahul's tested-by and reviewed-by - Add Stefano's reviewed-by --- xen/arch/arm/setup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index f16b33fa87a2..35e5bee04efa 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -987,7 +987,8 @@ void __init start_xen(unsigned long boot_phys_offset, =20 system_state =3D SYS_STATE_active; =20 - create_domUs(); + if ( acpi_disabled ) + create_domUs(); =20 domain_unpause_by_systemcontroller(dom0); =20 --=20 2.17.1 From nobody Sun May 5 18:27:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1603467752; cv=none; d=zohomail.com; s=zohoarc; b=ExBew+Yo0wNOfSa87eoVHc3eoJdOQEmNp1AUqQw+tC1fuAIaYRiodKLt48uomuf7JvYuVC05U0gJt3bLZnkaQQPlndfK4j7SBCgl3JDMKEKP84QjFwedlUZaUjfowEAZAk+KgmQ3gP44JqAMMYmMeT3TF3Gbu+MI0rQf0I1REhU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603467752; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=xtMpaYLn6G5WzirrAmp6ZgVW0jgej4JPXWVQTvLzkCo=; b=nqbO0y07PGW5RRgujIvmlyrh/mZAN+5r+R99SBf8IkVbuG6L8MFZUjX0IvOk26y3x3uMAH9VJ6JCh//INuSq0JJSQ1r82QY9758wun9/hMnTM++BE7ov1H9E6ErXQm+/tUZxiw+rc9uAdIG+06gblZAXELwwb+oIhaX54GCohs4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1603467752706378.8124667888643; Fri, 23 Oct 2020 08:42:32 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.11093.29425 (Exim 4.92) (envelope-from ) id 1kVzCp-00023I-T8; Fri, 23 Oct 2020 15:42:15 +0000 Received: by outflank-mailman (output) from mailman id 11093.29425; Fri, 23 Oct 2020 15:42:15 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCp-000236-Ot; Fri, 23 Oct 2020 15:42:15 +0000 Received: by outflank-mailman (input) for mailman id 11093; Fri, 23 Oct 2020 15:42:14 +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 1kVzCo-0001sI-11 for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 15:42:14 +0000 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id db9169e1-10ff-4b6d-9589-f36f9e8684c5; Fri, 23 Oct 2020 15:42:10 +0000 (UTC) Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCj-0006qo-SC; Fri, 23 Oct 2020 15:42:09 +0000 Received: from 54-240-197-235.amazon.com ([54.240.197.235] helo=ufe34d9ed68d054.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVzCj-0007wb-IJ; Fri, 23 Oct 2020 15:42:09 +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 1kVzCo-0001sI-11 for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 15:42:14 +0000 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id db9169e1-10ff-4b6d-9589-f36f9e8684c5; Fri, 23 Oct 2020 15:42:10 +0000 (UTC) Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCj-0006qo-SC; Fri, 23 Oct 2020 15:42:09 +0000 Received: from 54-240-197-235.amazon.com ([54.240.197.235] helo=ufe34d9ed68d054.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVzCj-0007wb-IJ; Fri, 23 Oct 2020 15:42:09 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: db9169e1-10ff-4b6d-9589-f36f9e8684c5 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=xtMpaYLn6G5WzirrAmp6ZgVW0jgej4JPXWVQTvLzkCo=; b=4IiEUZqsbsyOdS75K5/AVt7sW d4Q6IqmGbH8LriIHX2DeilsKgbwamOXU4sh/VLRB1onAOqLIG51TLQlaCaz1f29JfuclM1gPzSIET +lkNoBi4N/VJzh8IUCPeqRBxvAd7T+LT461M1c/Jg/f4EOgc4iawB2NUP3e2aYskdojLI=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: alex.bennee@linaro.org, masami.hiramatsu@linaro.org, ehem+xen@m5p.com, bertrand.marquis@arm.com, andre.przywara@arm.com, Rahul.Singh@arm.com, Julien Grall , Stefano Stabellini , Julien Grall , Volodymyr Babchuk Subject: [PATCH v2 4/7] xen/arm: Introduce fw_unreserved_regions() and use it Date: Fri, 23 Oct 2020 16:41:53 +0100 Message-Id: <20201023154156.6593-5-julien@xen.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201023154156.6593-1-julien@xen.org> References: <20201023154156.6593-1-julien@xen.org> X-ZohoMail-DKIM: pass (identity @xen.org) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Julien Grall Since commit 6e3e77120378 "xen/arm: setup: Relocate the Device-Tree later on in the boot", the device-tree will not be kept mapped when using ACPI. However, a few places are calling dt_unreserved_regions() which expects a valid DT. This will lead to a crash. As the DT should not be used for ACPI (other than for detecting the modules), a new function fw_unreserved_regions() is introduced. It will behave the same way on DT system. On ACPI system, it will unreserve the whole region. Take the opportunity to clarify that bootinfo.reserved_mem is only used when booting using Device-Tree. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini Tested-by: Elliott Mitchell --- Is there any region we should exclude on ACPI? Changes in v2: - Add a comment on top of bootinfo.reserved_mem. --- xen/arch/arm/kernel.c | 2 +- xen/arch/arm/setup.c | 22 +++++++++++++++++----- xen/include/asm-arm/setup.h | 3 ++- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c index 032923853f2c..ab78689ed2a6 100644 --- a/xen/arch/arm/kernel.c +++ b/xen/arch/arm/kernel.c @@ -307,7 +307,7 @@ static __init int kernel_decompress(struct bootmodule *= mod) * Free the original kernel, update the pointers to the * decompressed kernel */ - dt_unreserved_regions(addr, addr + size, init_domheap_pages, 0); + fw_unreserved_regions(addr, addr + size, init_domheap_pages, 0); =20 return 0; } diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 35e5bee04efa..7fcff9af2a7e 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -196,8 +196,9 @@ static void __init processor_id(void) processor_setup(); } =20 -void __init dt_unreserved_regions(paddr_t s, paddr_t e, - void (*cb)(paddr_t, paddr_t), int first) +static void __init dt_unreserved_regions(paddr_t s, paddr_t e, + void (*cb)(paddr_t, paddr_t), + int first) { int i, nr =3D fdt_num_mem_rsv(device_tree_flattened); =20 @@ -244,6 +245,17 @@ void __init dt_unreserved_regions(paddr_t s, paddr_t e, cb(s, e); } =20 +void __init fw_unreserved_regions(paddr_t s, paddr_t e, + void (*cb)(paddr_t, paddr_t), int first) +{ + if ( acpi_disabled ) + dt_unreserved_regions(s, e, cb, first); + else + cb(s, e); +} + + + struct bootmodule __init *add_boot_module(bootmodule_kind kind, paddr_t start, paddr_t size, bool domU) @@ -405,7 +417,7 @@ void __init discard_initial_modules(void) !mfn_valid(maddr_to_mfn(e)) ) continue; =20 - dt_unreserved_regions(s, e, init_domheap_pages, 0); + fw_unreserved_regions(s, e, init_domheap_pages, 0); } =20 mi->nr_mods =3D 0; @@ -712,7 +724,7 @@ static void __init setup_mm(void) n =3D mfn_to_maddr(mfn_add(xenheap_mfn_start, xenheap_page= s)); } =20 - dt_unreserved_regions(s, e, init_boot_pages, 0); + fw_unreserved_regions(s, e, init_boot_pages, 0); =20 s =3D n; } @@ -765,7 +777,7 @@ static void __init setup_mm(void) if ( e > bank_end ) e =3D bank_end; =20 - dt_unreserved_regions(s, e, init_boot_pages, 0); + fw_unreserved_regions(s, e, init_boot_pages, 0); s =3D n; } } diff --git a/xen/include/asm-arm/setup.h b/xen/include/asm-arm/setup.h index 2f8f24e286ed..28bf622aa196 100644 --- a/xen/include/asm-arm/setup.h +++ b/xen/include/asm-arm/setup.h @@ -67,6 +67,7 @@ struct bootcmdlines { =20 struct bootinfo { struct meminfo mem; + /* The reserved regions are only used when booting using Device-Tree */ struct meminfo reserved_mem; struct bootmodules modules; struct bootcmdlines cmdlines; @@ -96,7 +97,7 @@ int construct_dom0(struct domain *d); void create_domUs(void); =20 void discard_initial_modules(void); -void dt_unreserved_regions(paddr_t s, paddr_t e, +void fw_unreserved_regions(paddr_t s, paddr_t e, void (*cb)(paddr_t, paddr_t), int first); =20 size_t boot_fdt_info(const void *fdt, paddr_t paddr); --=20 2.17.1 From nobody Sun May 5 18:27:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1603467750; cv=none; d=zohomail.com; s=zohoarc; b=gjoDmnZcK2eaJnjPor6G4envAIQ/Z6gALo1meB07mbA/EEgkUoan20s+IuFjlxaHMlJST5wiQPJL95OnrmxIdpaTR5ep2FsNH7cAEeHJ0Xr/Ph9aWsNJqcqgtmv0gEzIPRfX6r3kJLQE4BBVvFhjCL34zSjzm8lreSCaq1nhIpQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603467750; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=3b+zUC4rUGoRV/bU3U7XTe8hxIwKqKy/A0anE7Xt22g=; b=WozHbNA9Kdqbyn6SNxwIngjZLD1H11ykLqDLWhMS+mFhXQ/yz3XraZnwdbJUQBg/GTt+BhLXrcpZqQLieZcJqeF0dhOWPy6Vzk5UnD+RnQpPA6NqxTatVLtk0kIlBrUqxfvyQXIeVkKraCnOvhJZevvms7EYCSbV6vKphWBeRi8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1603467750262674.63745716124; Fri, 23 Oct 2020 08:42:30 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.11092.29413 (Exim 4.92) (envelope-from ) id 1kVzCo-00020v-HM; Fri, 23 Oct 2020 15:42:14 +0000 Received: by outflank-mailman (output) from mailman id 11092.29413; Fri, 23 Oct 2020 15:42:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCo-00020m-Dh; Fri, 23 Oct 2020 15:42:14 +0000 Received: by outflank-mailman (input) for mailman id 11092; Fri, 23 Oct 2020 15:42:13 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCn-000207-Fv for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 15:42:13 +0000 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id eb530848-315a-4f24-8da9-04ff76f25cbb; Fri, 23 Oct 2020 15:42:12 +0000 (UTC) Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCl-0006r5-V8; Fri, 23 Oct 2020 15:42:11 +0000 Received: from 54-240-197-235.amazon.com ([54.240.197.235] helo=ufe34d9ed68d054.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVzCl-0007wb-L8; Fri, 23 Oct 2020 15:42:11 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCn-000207-Fv for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 15:42:13 +0000 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id eb530848-315a-4f24-8da9-04ff76f25cbb; Fri, 23 Oct 2020 15:42:12 +0000 (UTC) Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCl-0006r5-V8; Fri, 23 Oct 2020 15:42:11 +0000 Received: from 54-240-197-235.amazon.com ([54.240.197.235] helo=ufe34d9ed68d054.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVzCl-0007wb-L8; Fri, 23 Oct 2020 15:42:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: eb530848-315a-4f24-8da9-04ff76f25cbb DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=3b+zUC4rUGoRV/bU3U7XTe8hxIwKqKy/A0anE7Xt22g=; b=Ex15/X/yHkm5VcqouUFLOTVy2 GjAr5mN3s7s1NO5KlyhbJPi3JBiSWWOGhwHextGMcqmtQ3f5SmArE0zeJnS0LygZo9+oSD2M3jQcb ECX6CjrkpWg9hBAsPW4DNfNfbmt2qPrknD9dwVZLJ+XUafyOc6C3Q0WD8H8oy2zuwJvZo=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: alex.bennee@linaro.org, masami.hiramatsu@linaro.org, ehem+xen@m5p.com, bertrand.marquis@arm.com, andre.przywara@arm.com, Rahul.Singh@arm.com, Julien Grall , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Julien Grall Subject: [PATCH v2 5/7] xen/arm: acpi: add BAD_MADT_GICC_ENTRY() macro Date: Fri, 23 Oct 2020 16:41:54 +0100 Message-Id: <20201023154156.6593-6-julien@xen.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201023154156.6593-1-julien@xen.org> References: <20201023154156.6593-1-julien@xen.org> X-ZohoMail-DKIM: pass (identity @xen.org) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Julien Grall Imported from Linux commit b6cfb277378ef831c0fa84bcff5049307294adc6: The BAD_MADT_ENTRY() macro is designed to work for all of the subtables of the MADT. In the ACPI 5.1 version of the spec, the struct for the GICC subtable (struct acpi_madt_generic_interrupt) is 76 bytes long; in ACPI 6.0, the struct is 80 bytes long. But, there is only one definiti= on in ACPICA for this struct -- and that is the 6.0 version. Hence, when BAD_MADT_ENTRY() compares the struct size to the length in the GICC subtable, it fails if 5.1 structs are in use, and there are systems in the wild that have them. This patch adds the BAD_MADT_GICC_ENTRY() that checks the GICC subtable only, accounting for the difference in specification versions that are possible. The BAD_MADT_ENTRY() will continue to work as is for all oth= er MADT subtables. This code is being added to an arm64 header file since that is currently the only architecture using the GICC subtable of the MADT. As a GIC is specific to ARM, it is also unlikely the subtable will be used elsewher= e. Fixes: aeb823bbacc2 ("ACPICA: ACPI 6.0: Add changes for FADT table.") Signed-off-by: Al Stone Acked-by: Will Deacon Acked-by: "Rafael J. Wysocki" [catalin.marinas@arm.com: extra brackets around macro arguments] Signed-off-by: Catalin Marinas Signed-off-by: Julien Grall Signed-off-by: Andre Przywara Signed-off-by: Julien Grall Acked-by: Stefano Stabellini Tested-by: Elliott Mitchell --- Changes in v2: - Patch added We may want to consider to also import: commit 9eb1c92b47c73249465d388eaa394fe436a3b489 Author: Jeremy Linton Date: Tue Nov 27 17:59:12 2018 +0000 arm64: acpi: Prepare for longer MADTs The BAD_MADT_GICC_ENTRY check is a little too strict because it rejects MADT entries that don't match the currently known lengths. We should remove this restriction to avoid problems if the table length changes. Future code which might depend on additional fields should be written to validate those fields before using them, rather than trying to globally check known MADT version lengths. Link: https://lkml.kernel.org/r/20181012192937.3819951-1-jeremy.linton@= arm.com Signed-off-by: Jeremy Linton [lorenzo.pieralisi@arm.com: added MADT macro comments] Signed-off-by: Lorenzo Pieralisi Acked-by: Sudeep Holla Cc: Will Deacon Cc: Catalin Marinas Cc: Al Stone Cc: "Rafael J. Wysocki" Signed-off-by: Will Deacon --- xen/include/asm-arm/acpi.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xen/include/asm-arm/acpi.h b/xen/include/asm-arm/acpi.h index 50340281a917..b52ae2d6ef72 100644 --- a/xen/include/asm-arm/acpi.h +++ b/xen/include/asm-arm/acpi.h @@ -54,6 +54,14 @@ void acpi_smp_init_cpus(void); */ paddr_t acpi_get_table_offset(struct membank tbl_add[], EFI_MEM_RES index); =20 +/* Macros for consistency checks of the GICC subtable of MADT */ +#define ACPI_MADT_GICC_LENGTH \ + (acpi_gbl_FADT.header.revision < 6 ? 76 : 80) + +#define BAD_MADT_GICC_ENTRY(entry, end) \ + (!(entry) || (unsigned long)(entry) + sizeof(*(entry)) > (end) || \ + (entry)->header.length !=3D ACPI_MADT_GICC_LENGTH) + #ifdef CONFIG_ACPI extern bool acpi_disabled; /* Basic configuration for ACPI */ --=20 2.17.1 From nobody Sun May 5 18:27:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1603467751; cv=none; d=zohomail.com; s=zohoarc; b=gOyQOoW3EvuDuj1/pF1oqOeiLtO4c7ExvCG+H6UTutmyeq6M44cOy2knbgwLY5Kl7sdLWsW1+zJPl4o7fidY0weKuX5vP8gn4UNLgQr0NCvdlp9ttYHZw38l97QHFEoumsrL/23LVzWyB6YWJV4DQobqnQGQqEjaM6qwuLEV0hY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603467751; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=0dMZlXEOpL//B8eU1LrZwd4fsJbSpHy+FuAFJFAQtlc=; b=a4AoE282EIYEU7XaL8umB+ze13asOY4SR45Wj2QM8hbXn8ndGy4vcn7ROEgGTO7fYruL1QmPaqfWUXUBV9Evk7T0d+vc5LNrBJyI/hM6WVCqXrLMfNkKoOyUSMPoY0tcP+MwuIpdouQCfkle90QE1DCbcT4QlAGwAQqwnW41K1g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1603467751724851.4368682893448; Fri, 23 Oct 2020 08:42:31 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.11094.29437 (Exim 4.92) (envelope-from ) id 1kVzCr-00025r-7e; Fri, 23 Oct 2020 15:42:17 +0000 Received: by outflank-mailman (output) from mailman id 11094.29437; Fri, 23 Oct 2020 15:42:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCr-00025g-2t; Fri, 23 Oct 2020 15:42:17 +0000 Received: by outflank-mailman (input) for mailman id 11094; Fri, 23 Oct 2020 15:42:16 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCq-000207-Gj for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 15:42:16 +0000 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id bfc2abb2-916e-40ab-af75-851762a3b815; Fri, 23 Oct 2020 15:42:14 +0000 (UTC) Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCo-0006rJ-1R; Fri, 23 Oct 2020 15:42:14 +0000 Received: from 54-240-197-235.amazon.com ([54.240.197.235] helo=ufe34d9ed68d054.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVzCn-0007wb-Nx; Fri, 23 Oct 2020 15:42:14 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCq-000207-Gj for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 15:42:16 +0000 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id bfc2abb2-916e-40ab-af75-851762a3b815; Fri, 23 Oct 2020 15:42:14 +0000 (UTC) Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCo-0006rJ-1R; Fri, 23 Oct 2020 15:42:14 +0000 Received: from 54-240-197-235.amazon.com ([54.240.197.235] helo=ufe34d9ed68d054.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVzCn-0007wb-Nx; Fri, 23 Oct 2020 15:42:14 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: bfc2abb2-916e-40ab-af75-851762a3b815 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=0dMZlXEOpL//B8eU1LrZwd4fsJbSpHy+FuAFJFAQtlc=; b=o9ZBsOfjpCE2qodp6iwnSik+u /G+MLIopOzwOuzu2Lmno4MWQQrO/cZynUbVEs63UAVkSCM3fyYYmzXokXvilQ/c7IGOwK5U1wAekT Dw5d1ThSe8xhB6wIYvxxmtDzs58TvYrwgfq3h64UMsEF8rZ+hLoV91zXPlh9d7iNpHS7k=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: alex.bennee@linaro.org, masami.hiramatsu@linaro.org, ehem+xen@m5p.com, bertrand.marquis@arm.com, andre.przywara@arm.com, Rahul.Singh@arm.com, Julien Grall , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Julien Grall Subject: [PATCH v2 6/7] xen/arm: gic-v2: acpi: Use the correct length for the GICC structure Date: Fri, 23 Oct 2020 16:41:55 +0100 Message-Id: <20201023154156.6593-7-julien@xen.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201023154156.6593-1-julien@xen.org> References: <20201023154156.6593-1-julien@xen.org> X-ZohoMail-DKIM: pass (identity @xen.org) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Julien Grall The length of the GICC structure in the MADT ACPI table differs between version 5.1 and 6.0, although there are no other relevant differences. Use the BAD_MADT_GICC_ENTRY macro, which was specifically designed to overcome this issue. Signed-off-by: Julien Grall Signed-off-by: Andre Przywara Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini Tested-by: Elliott Mitchell --- Changes in v2: - Patch added --- xen/arch/arm/acpi/boot.c | 2 +- xen/arch/arm/gic-v2.c | 5 +++-- xen/arch/arm/gic-v3.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/acpi/boot.c b/xen/arch/arm/acpi/boot.c index 30e4bd1bc5a7..55c3e5cbc834 100644 --- a/xen/arch/arm/acpi/boot.c +++ b/xen/arch/arm/acpi/boot.c @@ -131,7 +131,7 @@ acpi_parse_gic_cpu_interface(struct acpi_subtable_heade= r *header, struct acpi_madt_generic_interrupt *processor =3D container_of(header, struct acpi_madt_generic_interrupt, he= ader); =20 - if ( BAD_MADT_ENTRY(processor, end) ) + if ( BAD_MADT_GICC_ENTRY(processor, end) ) return -EINVAL; =20 acpi_table_print_madt_entry(header); diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c index 0f747538dbcd..0e5f23201974 100644 --- a/xen/arch/arm/gic-v2.c +++ b/xen/arch/arm/gic-v2.c @@ -1136,7 +1136,8 @@ static int gicv2_make_hwdom_madt(const struct domain = *d, u32 offset) =20 host_gicc =3D container_of(header, struct acpi_madt_generic_interrupt, header); - size =3D sizeof(struct acpi_madt_generic_interrupt); + + size =3D ACPI_MADT_GICC_LENGTH; /* Add Generic Interrupt */ for ( i =3D 0; i < d->max_vcpus; i++ ) { @@ -1165,7 +1166,7 @@ gic_acpi_parse_madt_cpu(struct acpi_subtable_header *= header, struct acpi_madt_generic_interrupt *processor =3D container_of(header, struct acpi_madt_generic_interrupt, he= ader); =20 - if ( BAD_MADT_ENTRY(processor, end) ) + if ( BAD_MADT_GICC_ENTRY(processor, end) ) return -EINVAL; =20 /* Read from APIC table and fill up the GIC variables */ diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index 0f6cbf6224e9..ce202402c0ed 100644 --- a/xen/arch/arm/gic-v3.c +++ b/xen/arch/arm/gic-v3.c @@ -1558,7 +1558,7 @@ gic_acpi_parse_madt_cpu(struct acpi_subtable_header *= header, struct acpi_madt_generic_interrupt *processor =3D container_of(header, struct acpi_madt_generic_interrupt, he= ader); =20 - if ( BAD_MADT_ENTRY(processor, end) ) + if ( BAD_MADT_GICC_ENTRY(processor, end) ) return -EINVAL; =20 /* Read from APIC table and fill up the GIC variables */ --=20 2.17.1 From nobody Sun May 5 18:27:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1603467758; cv=none; d=zohomail.com; s=zohoarc; b=GpYgWlu7injLbbHV5vJC40ehP9ez2iYhIf2vxo1EiaKZ/vyH1Fovuib+7atCTdweb4O2LtSGUMp0b/Z/gNRhMQWsTd+hOkBUZcjGfqWCG9RWSeDu4QNnBZewmHbi3icSRQwAduXIKJp+n5unH9oN3BbSQoLRK9f/VAl7LVEQ8uY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603467758; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=9Jhhh200nUTGbCy8jyEQ9Z0MRCAcS0zUrLABG2/n+kQ=; b=FiiReZ6cAd6PYyFufJdwydsKlTm5RM4knZdszMt+bJx6i/Gty9/XE+B8W/27E6USIDWu3HZO8P8LvN/LFok11vqUyE+ZRv97J2TQ1MiHR5tuXbbdj5zCvVxC9F6x/j3z+b3rvtvP7NxBl3kZWxSCPsskIo1IGEF1uIj4a6DVBHg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 160346775879927.995872928885888; Fri, 23 Oct 2020 08:42:38 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.11096.29461 (Exim 4.92) (envelope-from ) id 1kVzCx-0002GC-5H; Fri, 23 Oct 2020 15:42:23 +0000 Received: by outflank-mailman (output) from mailman id 11096.29461; Fri, 23 Oct 2020 15:42:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCx-0002G3-0B; Fri, 23 Oct 2020 15:42:23 +0000 Received: by outflank-mailman (input) for mailman id 11096; Fri, 23 Oct 2020 15:42:21 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCv-000207-H1 for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 15:42:21 +0000 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b3237385-ff05-47ad-a248-91e89864f56d; Fri, 23 Oct 2020 15:42:16 +0000 (UTC) Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCq-0006rW-47; Fri, 23 Oct 2020 15:42:16 +0000 Received: from 54-240-197-235.amazon.com ([54.240.197.235] helo=ufe34d9ed68d054.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVzCp-0007wb-Qi; Fri, 23 Oct 2020 15:42:16 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCv-000207-H1 for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 15:42:21 +0000 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b3237385-ff05-47ad-a248-91e89864f56d; Fri, 23 Oct 2020 15:42:16 +0000 (UTC) Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVzCq-0006rW-47; Fri, 23 Oct 2020 15:42:16 +0000 Received: from 54-240-197-235.amazon.com ([54.240.197.235] helo=ufe34d9ed68d054.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVzCp-0007wb-Qi; Fri, 23 Oct 2020 15:42:16 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: b3237385-ff05-47ad-a248-91e89864f56d DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=9Jhhh200nUTGbCy8jyEQ9Z0MRCAcS0zUrLABG2/n+kQ=; b=eU6k8QiNQIfc2naCg2wGciaPZ fP1QY7kRegzgMuXtFrMcdCK5j9lxQdhdIer7ua0FYk7Svf07Z5VnSqKPyt83G+8nqUd2mIJfh61nw RdUQVmZd9hfqyEns2XOKDe+9eEgPW3OqR1ZsALtkkvrH1WwSKqH46Xxqu2aCmerLEyJv0=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: alex.bennee@linaro.org, masami.hiramatsu@linaro.org, ehem+xen@m5p.com, bertrand.marquis@arm.com, andre.przywara@arm.com, Rahul.Singh@arm.com, Julien Grall , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Julien Grall Subject: [PATCH v2 7/7] xen/arm: acpi: Allow Xen to boot with ACPI 5.1 Date: Fri, 23 Oct 2020 16:41:56 +0100 Message-Id: <20201023154156.6593-8-julien@xen.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201023154156.6593-1-julien@xen.org> References: <20201023154156.6593-1-julien@xen.org> X-ZohoMail-DKIM: pass (identity @xen.org) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Julien Grall At the moment Xen requires the FADT ACPI table to be at least version 6.0, apparently because of some reliance on other ACPI v6.0 features. But actually this is overzealous, and Xen works now fine with ACPI v5.1. Let's relax the version check for the FADT table to allow QEMU to run the hypervisor with ACPI. Signed-off-by: Julien Grall Signed-off-by: Andre Przywara Signed-off-by: Julien Grall Acked-by: Stefano Stabellini Tested-by: Elliott Mitchell --- Changes in v2: - Patch added --- xen/arch/arm/acpi/boot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/acpi/boot.c b/xen/arch/arm/acpi/boot.c index 55c3e5cbc834..7ea2990cb82c 100644 --- a/xen/arch/arm/acpi/boot.c +++ b/xen/arch/arm/acpi/boot.c @@ -181,8 +181,8 @@ static int __init acpi_parse_fadt(struct acpi_table_hea= der *table) * we only deal with ACPI 6.0 or newer revision to get GIC and SMP * boot protocol configuration data, or we will disable ACPI. */ - if ( table->revision > 6 - || (table->revision =3D=3D 6 && fadt->minor_revision >=3D 0) ) + if ( table->revision > 5 + || (table->revision =3D=3D 5 && fadt->minor_revision >=3D 1) ) return 0; =20 printk("Unsupported FADT revision %d.%d, should be 6.0+, will disable = ACPI\n", --=20 2.17.1