From nobody Fri May 17 11:58:59 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=1660332330; cv=none; d=zohomail.com; s=zohoarc; b=neENg1haIlwAYRpc9D7yuHc7cirYXotSKiFjGQs+sLmtJdrwVV+5Ah5hFyxMDWQQqzOpDIynuySfi+qgpm9c5ksmTgZ1Udau3lvT6B3AeziS1NLYzJ9TxtZN9IJote3jD5OTwVE903M2G0ht1oIeXLChQcGiq/g7HqbBnNHnoYg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660332330; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1G2Qt2AMX5j11jO0S4LFhw33Cq6gRJqjfValRIvJxXM=; b=IK9ITDN6BQ7bkte3Z2wBhv9bQPFWJ4KRX3DDYzG3YzIo/7dffMelpbtEDmR6M8EhDigfsZUFN/usMxKIH1NwZ1iNsEWfGgF7f+DBlZ6JC2oNgHH//R/QaaF6Z7cACoKGRtc0ukvkundQgv7UG0JLSE7SnOJ7MF9gUb3bWUyufQg= 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 1660332330882882.5485696982828; Fri, 12 Aug 2022 12:25:30 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.385855.621639 (Exim 4.92) (envelope-from ) id 1oMaHP-0000Ve-1A; Fri, 12 Aug 2022 19:25:11 +0000 Received: by outflank-mailman (output) from mailman id 385855.621639; Fri, 12 Aug 2022 19:25: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 1oMaHO-0000VX-T8; Fri, 12 Aug 2022 19:25:10 +0000 Received: by outflank-mailman (input) for mailman id 385855; Fri, 12 Aug 2022 19:25:09 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMaHN-0000FX-4o for xen-devel@lists.xenproject.org; Fri, 12 Aug 2022 19:25:09 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMaHM-0000xY-SH; Fri, 12 Aug 2022 19:25:08 +0000 Received: from 54-240-197-224.amazon.com ([54.240.197.224] helo=dev-dsk-jgrall-1b-035652ec.eu-west-1.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oMaHM-0006n6-Js; Fri, 12 Aug 2022 19:25:08 +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" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=1G2Qt2AMX5j11jO0S4LFhw33Cq6gRJqjfValRIvJxXM=; b=wG7b+kJxPPFG3besl9gWU5of8e C7nM6s3pbhEZDBdgS9KDNWWChZVzaYR74kPR/yg6YpR8XR+7tSIszLd7l5cG+YPywhg3qLBj4HuC3 GF+2LuvmVa29mkcrbf53zQ5V/vVzdsqoR3Cee/qRnf6TJX4z0oPfDuQBugPX+Gd1hzuM=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: julien@xen.org, Julien Grall , Stefano Stabellini , Bertrand Marquis , Volodymyr Babchuk Subject: [PATCH 1/7] xen/arm64: head: Don't set x22 and update the documentation Date: Fri, 12 Aug 2022 20:24:40 +0100 Message-Id: <20220812192448.43016-2-julien@xen.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220812192448.43016-1-julien@xen.org> References: <20220812192448.43016-1-julien@xen.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @xen.org) X-ZM-MESSAGEID: 1660332332685100001 Content-Type: text/plain; charset="utf-8" From: Julien Grall Since commit 7e14a47e7c73 ("xen/arm64: head Rework and document launch()"), the boot code is setting x22 but not read it. So remove the two instructions setting x22 and update the documentation to show x22 has no specific purpose. Signed-off-by: Julien Grall Reviewed-by: Bertrand Marquis Reviewed-by: Wei Chen --- xen/arch/arm/arm64/head.S | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index 1babcc65d7c9..26cc7705f556 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -71,7 +71,7 @@ * x19 - paddr(start) * x20 - phys offset * x21 - DTB address (boot cpu only) - * x22 - is_secondary_cpu + * x22 - * x23 - UART address * x24 - * x25 - @@ -305,8 +305,6 @@ real_start_efi: #endif PRINT("- Boot CPU booting -\r\n") =20 - mov x22, #0 /* x22 :=3D is_secondary_cpu */ - bl check_cpu_mode bl cpu_init bl create_page_tables @@ -345,8 +343,6 @@ GLOBAL(init_secondary) adr x19, start /* x19 :=3D paddr (start) */ sub x20, x19, x0 /* x20 :=3D phys-offset */ =20 - mov x22, #1 /* x22 :=3D is_secondary_cpu */ - mrs x0, mpidr_el1 ldr x13, =3D(~MPIDR_HWID_MASK) bic x24, x0, x13 /* Mask out flags to get CPU ID */ --=20 2.37.1 From nobody Fri May 17 11:58:59 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=1660332332; cv=none; d=zohomail.com; s=zohoarc; b=cKmlHGSOcxMWNYDfYu13gy5RsU+C01wyRKl3lHEiq33K+h1OhnpY/f5jHS1Pyu8gvKjzfdQMF0S1D5yUPE+kMp9P5T04sS2Z9b1D+eH9AVie389cQ5jEwl1ikiUBYdZ9qz+aaWnMHzNdspdxp/JlGrNwi3ZwOpGzJHTxTAmuDus= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660332332; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ngshIEE2EN6MEfw9zmbHPOq0MvbgTTFSHuQTBxj5Rkw=; b=bkDoITYiOUYjICvtgJuwIR6uNNOAB2Lw4i4KdZrWaI5bxxPck5mTnJR8aCJVAGWUZ2Y38zgt3JYBPFzzTV+fk/jPOvOUnNEHrvHND7z/cOF9SoiRPI7cT8rQcMTUbhL5mi7FnQmLMYeRs65O60dC5tk9eXdVPhXLDtil6a4OizY= 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 1660332332959621.8053090935457; Fri, 12 Aug 2022 12:25:32 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.385856.621647 (Exim 4.92) (envelope-from ) id 1oMaHP-0000d8-JI; Fri, 12 Aug 2022 19:25:11 +0000 Received: by outflank-mailman (output) from mailman id 385856.621647; Fri, 12 Aug 2022 19:25:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMaHP-0000bb-CI; Fri, 12 Aug 2022 19:25:11 +0000 Received: by outflank-mailman (input) for mailman id 385856; Fri, 12 Aug 2022 19:25:10 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMaHO-0000OU-3A for xen-devel@lists.xenproject.org; Fri, 12 Aug 2022 19:25:10 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMaHN-0000xo-TP; Fri, 12 Aug 2022 19:25:09 +0000 Received: from 54-240-197-224.amazon.com ([54.240.197.224] helo=dev-dsk-jgrall-1b-035652ec.eu-west-1.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oMaHN-0006n6-LI; Fri, 12 Aug 2022 19:25: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" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=ngshIEE2EN6MEfw9zmbHPOq0MvbgTTFSHuQTBxj5Rkw=; b=6AOrZflQqxWt6ZUuxW+F80X5TW UkChC67IgilFd/Mv8haKA1DcebMlYmv7kYezggohNyTbySnsmPaTpFm+bsWk+RkYu01XIg9PCzByT e5e6SvFQz0NFelgVgSfpcKU/8vim9tSGvDSFS6WqnAl2WAJ7mZSvqTgxE+5FR5qXKcB4=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: julien@xen.org, Julien Grall , Stefano Stabellini , Bertrand Marquis , Volodymyr Babchuk Subject: [PATCH 2/7] xen/arm64: head: Introduce get_table_slot() and use it Date: Fri, 12 Aug 2022 20:24:41 +0100 Message-Id: <20220812192448.43016-3-julien@xen.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220812192448.43016-1-julien@xen.org> References: <20220812192448.43016-1-julien@xen.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @xen.org) X-ZM-MESSAGEID: 1660332334639100006 Content-Type: text/plain; charset="utf-8" From: Julien Grall There are a few places in the code that need to find the slot at a given page-table level. So create a new macro get_table_slot() for that. This will reduce the effort to figure out whether the code is doing the right thing. Take the opportunity to use 'ubfx'. The only benefits is reducing the number of instructions from 2 to 1. The new macro is used everywhere we need to compute the slot. This requires to tweak the parameter of create_table_entry() to pass a level rather than shift. Note, for slot 0 the code is currently skipping the masking part. While this is fine, it is safer to mask it as technically slot 0 only covers bit 48 - 39 bit (assuming 4KB page granularity). Take the opportunity to correct the comment when finding the second slot for the identity mapping (we are computing the second slot rather than first). Signed-off-by: Julien Grall Reviewed-by: Bertrand Marquis Reviewed-by: Wei Chen ---- This patch also has the benefits to reduce the number of use of {ZEROETH, FIRST, SECOND, THIRD}_SHIFT. The next patch for arm32 will reduce further. --- xen/arch/arm/arm64/head.S | 55 +++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index 26cc7705f556..ad014716db6f 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -493,13 +493,24 @@ cpu_init: ret ENDPROC(cpu_init) =20 +/* + * Macro to find the slot number at a given page-table level + * + * slot: slot computed + * virt: virtual address + * lvl: page-table level + */ +.macro get_table_slot, slot, virt, lvl + ubfx \slot, \virt, #XEN_PT_LEVEL_SHIFT(\lvl), #XEN_PT_LPAE_SHIFT +.endm + /* * Macro to create a page table entry in \ptbl to \tbl * * ptbl: table symbol where the entry will be created * tbl: table symbol to point to * virt: virtual address - * shift: #imm page table shift + * lvl: page-table level * tmp1: scratch register * tmp2: scratch register * tmp3: scratch register @@ -511,9 +522,8 @@ ENDPROC(cpu_init) * * Note that all parameters using registers should be distinct. */ -.macro create_table_entry, ptbl, tbl, virt, shift, tmp1, tmp2, tmp3 - lsr \tmp1, \virt, #\shift - and \tmp1, \tmp1, #XEN_PT_LPAE_ENTRY_MASK/* \tmp1 :=3D slot in \= tlb */ +.macro create_table_entry, ptbl, tbl, virt, lvl, tmp1, tmp2, tmp3 + get_table_slot \tmp1, \virt, \lvl /* \tmp1 :=3D slot in \tlb */ =20 load_paddr \tmp2, \tbl mov \tmp3, #PT_PT /* \tmp3 :=3D right for linear= PT */ @@ -544,8 +554,7 @@ ENDPROC(cpu_init) .macro create_mapping_entry, ptbl, virt, phys, tmp1, tmp2, tmp3, type=3DPT= _MEM_L3 and \tmp3, \phys, #THIRD_MASK /* \tmp3 :=3D PAGE_ALIGNED(phy= s) */ =20 - lsr \tmp1, \virt, #THIRD_SHIFT - and \tmp1, \tmp1, #XEN_PT_LPAE_ENTRY_MASK/* \tmp1 :=3D slot in \= tlb */ + get_table_slot \tmp1, \virt, 3 /* \tmp1 :=3D slot in \tlb */ =20 mov \tmp2, #\type /* \tmp2 :=3D right for sectio= n PT */ orr \tmp2, \tmp2, \tmp3 /* + PAGE_ALIGNED(phy= s) */ @@ -573,9 +582,9 @@ ENDPROC(cpu_init) create_page_tables: /* Prepare the page-tables for mapping Xen */ ldr x0, =3DXEN_VIRT_START - create_table_entry boot_pgtable, boot_first, x0, ZEROETH_SHIFT, x1= , x2, x3 - create_table_entry boot_first, boot_second, x0, FIRST_SHIFT, x1, x= 2, x3 - create_table_entry boot_second, boot_third, x0, SECOND_SHIFT, x1, = x2, x3 + create_table_entry boot_pgtable, boot_first, x0, 0, x1, x2, x3 + create_table_entry boot_first, boot_second, x0, 1, x1, x2, x3 + create_table_entry boot_second, boot_third, x0, 2, x1, x2, x3 =20 /* Map Xen */ adr_l x4, boot_third @@ -612,10 +621,10 @@ create_page_tables: * XEN_ZEROETH_SLOT, then the 1:1 mapping will use its own set of * page-tables from the first level. */ - lsr x0, x19, #ZEROETH_SHIFT /* x0 :=3D zeroeth slot */ + get_table_slot x0, x19, 0 /* x0 :=3D zeroeth slot */ cmp x0, #XEN_ZEROETH_SLOT beq 1f - create_table_entry boot_pgtable, boot_first_id, x19, ZEROETH_SHIFT= , x0, x1, x2 + create_table_entry boot_pgtable, boot_first_id, x19, 0, x0, x1, x2 b link_from_first_id =20 1: @@ -624,11 +633,10 @@ create_page_tables: * then the 1:1 mapping will use its own set of page-tables from * the second level. */ - lsr x0, x19, #FIRST_SHIFT - and x0, x0, #XEN_PT_LPAE_ENTRY_MASK /* x0 :=3D first slot */ + get_table_slot x0, x19, 1 /* x0 :=3D first slot */ cmp x0, #XEN_FIRST_SLOT beq 1f - create_table_entry boot_first, boot_second_id, x19, FIRST_SHIFT, x= 0, x1, x2 + create_table_entry boot_first, boot_second_id, x19, 1, x0, x1, x2 b link_from_second_id =20 1: @@ -638,17 +646,16 @@ create_page_tables: * third level. For slot XEN_SECOND_SLOT, Xen is not yet able to h= andle * it. */ - lsr x0, x19, #SECOND_SHIFT - and x0, x0, #XEN_PT_LPAE_ENTRY_MASK /* x0 :=3D first slot */ + get_table_slot x0, x19, 2 /* x0 :=3D second slot */ cmp x0, #XEN_SECOND_SLOT beq virtphys_clash - create_table_entry boot_second, boot_third_id, x19, SECOND_SHIFT, = x0, x1, x2 + create_table_entry boot_second, boot_third_id, x19, 2, x0, x1, x2 b link_from_third_id =20 link_from_first_id: - create_table_entry boot_first_id, boot_second_id, x19, FIRST_SHIFT= , x0, x1, x2 + create_table_entry boot_first_id, boot_second_id, x19, 1, x0, x1, = x2 link_from_second_id: - create_table_entry boot_second_id, boot_third_id, x19, SECOND_SHIF= T, x0, x1, x2 + create_table_entry boot_second_id, boot_third_id, x19, 2, x0, x1, = x2 link_from_third_id: create_mapping_entry boot_third_id, x19, x19, x0, x1, x2 ret @@ -705,7 +712,7 @@ remove_identity_mapping: * Find the zeroeth slot used. Remove the entry from zeroeth * table if the slot is not XEN_ZEROETH_SLOT. */ - lsr x1, x19, #ZEROETH_SHIFT /* x1 :=3D zeroeth slot */ + get_table_slot x1, x19, 0 /* x1 :=3D zeroeth slot */ cmp x1, #XEN_ZEROETH_SLOT beq 1f /* It is not in slot XEN_ZEROETH_SLOT, remove the entry. */ @@ -718,8 +725,7 @@ remove_identity_mapping: * Find the first slot used. Remove the entry for the first * table if the slot is not XEN_FIRST_SLOT. */ - lsr x1, x19, #FIRST_SHIFT - and x1, x1, #XEN_PT_LPAE_ENTRY_MASK /* x1 :=3D first slot */ + get_table_slot x1, x19, 1 /* x1 :=3D first slot */ cmp x1, #XEN_FIRST_SLOT beq 1f /* It is not in slot XEN_FIRST_SLOT, remove the entry. */ @@ -732,8 +738,7 @@ remove_identity_mapping: * Find the second slot used. Remove the entry for the first * table if the slot is not XEN_SECOND_SLOT. */ - lsr x1, x19, #SECOND_SHIFT - and x1, x1, #XEN_PT_LPAE_ENTRY_MASK /* x1 :=3D first slot */ + get_table_slot x1, x19, 2 /* x1 :=3D second slot */ cmp x1, #XEN_SECOND_SLOT beq identity_mapping_removed /* It is not in slot 1, remove the entry */ @@ -771,7 +776,7 @@ setup_fixmap: #endif /* Map fixmap into boot_second */ ldr x0, =3DFIXMAP_ADDR(0) - create_table_entry boot_second, xen_fixmap, x0, SECOND_SHIFT, x1, = x2, x3 + create_table_entry boot_second, xen_fixmap, x0, 2, x1, x2, x3 /* Ensure any page table updates made above have occurred. */ dsb nshst =20 --=20 2.37.1 From nobody Fri May 17 11:58:59 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=1660332333; cv=none; d=zohomail.com; s=zohoarc; b=aLD36jZYWXP5EhJkByW2fPcaHf5d7cEYMpzJFBQokUIrEIjU9ZoHMcrvO/PTOyIz8CF6ViyX14JCKVjd8rxf5srxtwfbW8pdkhMRGvyYpv9uFuPDpEkyH9LwYbnePn6a03l/88f1hv9UDS1xIsZ0FEdwN4SbIYXpS7YJi885Vfk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660332333; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MmRrbC3kvaMa64yr7ie9nAhuc1w7gAgxG0UgP5uX0L8=; b=giilp2Llc/8fPBEYVrYgZHaJMLqx7iuXGgqU1O5R/sdbSFHI6laOkxAV+cWn/wTeFoxDSunUb0Byo4qO3OAfSBivscySges7gLnBD1MlJHdqhVIxNC7/ZE/2F8NPxvXdlx6sItgDZ5CYkkUeQO9vx0epTYjBUSKeR4k1Dw8NY/A= 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 1660332333430743.6536006569474; Fri, 12 Aug 2022 12:25:33 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.385857.621661 (Exim 4.92) (envelope-from ) id 1oMaHQ-00011V-Ow; Fri, 12 Aug 2022 19:25:12 +0000 Received: by outflank-mailman (output) from mailman id 385857.621661; Fri, 12 Aug 2022 19:25:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMaHQ-00010t-KG; Fri, 12 Aug 2022 19:25:12 +0000 Received: by outflank-mailman (input) for mailman id 385857; Fri, 12 Aug 2022 19:25:11 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMaHP-0000YD-6H for xen-devel@lists.xenproject.org; Fri, 12 Aug 2022 19:25:11 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMaHO-0000y0-UO; Fri, 12 Aug 2022 19:25:10 +0000 Received: from 54-240-197-224.amazon.com ([54.240.197.224] helo=dev-dsk-jgrall-1b-035652ec.eu-west-1.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oMaHO-0006n6-Mf; Fri, 12 Aug 2022 19:25:10 +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" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=MmRrbC3kvaMa64yr7ie9nAhuc1w7gAgxG0UgP5uX0L8=; b=Ax34ql9MUHf8TDUrgS8BWDGqTs g4yKR+4WvfivmMOR11aWb0vt+SAxtgpbEwF6pNTU2PBsYflRFTyFGu8IyDpvorJzau1be9ndyADQQ c0EYoKQC5g7ekNGxJMPzwjUvFPG6vbUdQpCdse9Yi8i4CniZxDggKvIqOw3V4yZtRyu4=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: julien@xen.org, Julien Grall , Stefano Stabellini , Bertrand Marquis , Volodymyr Babchuk Subject: [PATCH 3/7] xen/arm32: head: Introduce get_table_slot() and use it Date: Fri, 12 Aug 2022 20:24:42 +0100 Message-Id: <20220812192448.43016-4-julien@xen.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220812192448.43016-1-julien@xen.org> References: <20220812192448.43016-1-julien@xen.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @xen.org) X-ZM-MESSAGEID: 1660332334633100005 Content-Type: text/plain; charset="utf-8" From: Julien Grall There are a few places in the code that need to find the slot at a given page-table level. So create a new macro get_table_slot() for that. This will reduce the effort to figure out whether the code is doing the right thing. The new macro is using 'ubfx' (or 'lsr' for the first level) rather than the existing sequence (mov_w, lsr, and) because it doesn't require a scratch register and reduce the number of instructions (4 -> 1). Signed-off-by: Julien Grall Reviewed-by: Bertrand Marquis Reviewed-by: Wei Chen Tested-by: Bertrand Marquis --- xen/arch/arm/arm32/head.S | 56 ++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S index 46d93bebbabe..50f6fa4eb38d 100644 --- a/xen/arch/arm/arm32/head.S +++ b/xen/arch/arm/arm32/head.S @@ -358,13 +358,31 @@ cpu_init_done: mov pc, r5 /* Return address is in r5 */ ENDPROC(cpu_init) =20 +/* + * Macro to find the slot number at a given page-table level + * + * slot: slot computed + * virt: virtual address + * lvl: page-table level + * + * Note that ubxf is unpredictable when the end bit is above 32-bit. So we + * can't use it for first level offset. + */ +.macro get_table_slot, slot, virt, lvl + .if \lvl =3D=3D 1 + lsr \slot, \virt, #XEN_PT_LEVEL_SHIFT(\lvl) + .else + ubfx \slot, \virt, #XEN_PT_LEVEL_SHIFT(\lvl), #XEN_PT_LPAE_SHIFT + .endif +.endm + /* * Macro to create a page table entry in \ptbl to \tbl * * ptbl: table symbol where the entry will be created * tbl: table symbol to point to * virt: virtual address - * shift: #imm page table shift + * lvl: page-table level * mmu: Is the MMU turned on/off. If not specified it will be off * * Preserves \virt @@ -374,11 +392,9 @@ ENDPROC(cpu_init) * * Note that \virt should be in a register other than r1 - r4 */ -.macro create_table_entry, ptbl, tbl, virt, shift, mmu=3D0 - lsr r1, \virt, #\shift - mov_w r2, XEN_PT_LPAE_ENTRY_MASK - and r1, r1, r2 /* r1 :=3D slot in \tlb */ - lsl r1, r1, #3 /* r1 :=3D slot offset in \tlb */ +.macro create_table_entry, ptbl, tbl, virt, lvl, mmu=3D0 + get_table_slot r1, \virt, \lvl /* r1 :=3D slot in \tlb */ + lsl r1, r1, #3 /* r1 :=3D slot offset in \tlb */ =20 load_paddr r4, \tbl =20 @@ -448,8 +464,8 @@ ENDPROC(cpu_init) create_page_tables: /* Prepare the page-tables for mapping Xen */ ldr r0, =3DXEN_VIRT_START - create_table_entry boot_pgtable, boot_second, r0, FIRST_SHIFT - create_table_entry boot_second, boot_third, r0, SECOND_SHIFT + create_table_entry boot_pgtable, boot_second, r0, 1 + create_table_entry boot_second, boot_third, r0, 2 =20 /* Setup boot_third: */ adr_l r4, boot_third, mmu=3D0 @@ -486,12 +502,10 @@ create_page_tables: * then the 1:1 mapping will use its own set of page-tables from * the second level. */ - lsr r1, r9, #FIRST_SHIFT - mov_w r0, XEN_PT_LPAE_ENTRY_MASK - and r1, r1, r0 /* r1 :=3D first slot */ + get_table_slot r1, r9, 1 /* r1 :=3D first slot */ cmp r1, #XEN_FIRST_SLOT beq 1f - create_table_entry boot_pgtable, boot_second_id, r9, FIRST_SHIFT + create_table_entry boot_pgtable, boot_second_id, r9, 1 b link_from_second_id =20 1: @@ -501,16 +515,14 @@ create_page_tables: * third level. For slot XEN_SECOND_SLOT, Xen is not yet able to h= andle * it. */ - lsr r1, r9, #SECOND_SHIFT - mov_w r0, XEN_PT_LPAE_ENTRY_MASK - and r1, r1, r0 /* r1 :=3D second slot */ + get_table_slot r1, r9, 2 /* r1 :=3D second slot */ cmp r1, #XEN_SECOND_SLOT beq virtphys_clash - create_table_entry boot_second, boot_third_id, r9, SECOND_SHIFT + create_table_entry boot_second, boot_third_id, r9, 2 b link_from_third_id =20 link_from_second_id: - create_table_entry boot_second_id, boot_third_id, r9, SECOND_SHIFT + create_table_entry boot_second_id, boot_third_id, r9, 2 link_from_third_id: create_mapping_entry boot_third_id, r9, r9 mov pc, lr @@ -571,9 +583,7 @@ remove_identity_mapping: * Find the first slot used. Remove the entry for the first * table if the slot is not XEN_FIRST_SLOT. */ - lsr r1, r9, #FIRST_SHIFT - mov_w r0, XEN_PT_LPAE_ENTRY_MASK - and r1, r1, r0 /* r1 :=3D first slot */ + get_table_slot r1, r9, 1 /* r1 :=3D first slot */ cmp r1, #XEN_FIRST_SLOT beq 1f /* It is not in slot 0, remove the entry */ @@ -587,9 +597,7 @@ remove_identity_mapping: * Find the second slot used. Remove the entry for the first * table if the slot is not XEN_SECOND_SLOT. */ - lsr r1, r9, #SECOND_SHIFT - mov_w r0, XEN_PT_LPAE_ENTRY_MASK - and r1, r1, r0 /* r1 :=3D second slot */ + get_table_slot r1, r9, 2 /* r1 :=3D second slot */ cmp r1, #XEN_SECOND_SLOT beq identity_mapping_removed /* It is not in slot 1, remove the entry */ @@ -628,7 +636,7 @@ setup_fixmap: #endif /* Map fixmap into boot_second */ mov_w r0, FIXMAP_ADDR(0) - create_table_entry boot_second, xen_fixmap, r0, SECOND_SHIFT, mmu= =3D1 + create_table_entry boot_second, xen_fixmap, r0, 2, mmu=3D1 /* Ensure any page table updates made above have occurred. */ dsb nshst =20 --=20 2.37.1 From nobody Fri May 17 11:58:59 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=1660332333; cv=none; d=zohomail.com; s=zohoarc; b=c7trpgcOgVHL0vBI41tCPaSy6gwA7HjRSoHBdJlVDc1JpPst2jsG36hq9ArpqKHn7d0G+ssQfEB+3iMBPHdf9sGcywJedqBucpYhTxPO0EijykAbP0UFSLxdtvjAxVC64/k1rj9X2i5ESApIiEQQaocTUg2ZNqcRrsdhZ0OtDbc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660332333; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=UfWb+n83nlA+FfpERZvzgicr1KFfkvvT5C3RMOVERFw=; b=il2l9JW5Qx8cZo/baP308If8ubKYxQFYZHr0OPWn9h9dNPyr8gFFkRQWN3GaMWb1k+vxxAGlO+jGvi2NsMkCFAloXt5yxEI83UrAlFuIe8yfmF200sJ4KlQxXpjhzFM2GjU6LTuBXpfpX6XlXufAc71CJD7TTNW5GCam3xnprdQ= 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 1660332333938405.78143531402577; Fri, 12 Aug 2022 12:25:33 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.385858.621672 (Exim 4.92) (envelope-from ) id 1oMaHS-0001KW-69; Fri, 12 Aug 2022 19:25:14 +0000 Received: by outflank-mailman (output) from mailman id 385858.621672; Fri, 12 Aug 2022 19:25: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 1oMaHS-0001Jd-1j; Fri, 12 Aug 2022 19:25:14 +0000 Received: by outflank-mailman (input) for mailman id 385858; Fri, 12 Aug 2022 19:25:12 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMaHQ-0000wg-9V for xen-devel@lists.xenproject.org; Fri, 12 Aug 2022 19:25:12 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMaHP-0000yE-W3; Fri, 12 Aug 2022 19:25:11 +0000 Received: from 54-240-197-224.amazon.com ([54.240.197.224] helo=dev-dsk-jgrall-1b-035652ec.eu-west-1.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oMaHP-0006n6-O5; Fri, 12 Aug 2022 19:25: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" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=UfWb+n83nlA+FfpERZvzgicr1KFfkvvT5C3RMOVERFw=; b=W2b0baSx43V013hbPf7SzcRvE0 v/ztQ6YwuCVWGKXQGcZxazGfi2Flfd+KVf1T8WS98QpgSNX+g6zRFe7dzqvLEMEwgAHE6WNpOb3Xo CEo/Uth0uA0+CJANi7xO3p5FxPZsW+wp2jGvk7cy2ZyfxGgeeUjKdg8HVpxN3qZ15vHM=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: julien@xen.org, Julien Grall , Stefano Stabellini , Bertrand Marquis , Volodymyr Babchuk Subject: [PATCH 4/7] xen/arm32: heap: Rework adr_l so it doesn't rely on where Xen is loaded Date: Fri, 12 Aug 2022 20:24:43 +0100 Message-Id: <20220812192448.43016-5-julien@xen.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220812192448.43016-1-julien@xen.org> References: <20220812192448.43016-1-julien@xen.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @xen.org) X-ZM-MESSAGEID: 1660332334623100004 Content-Type: text/plain; charset="utf-8" From: Julien Grall At the moment, the macro addr_l needs to know whether the caller is running with the MMU on. This is fine today because there are only two possible cases: 1) MMU off 2) MMU on and linked to the virtual address This is still cumbersome to use for the developer as they need to know if the MMU is on. Thankfully, Linux developpers came up with a great way to allow adr_l to work within the range +/- 4GB of PC by emitting a PC-relative reference [1]. Re-use the same approach on Arm and drop the parameter 'mmu'. [1] 0b1674638a5c ("ARM: assembler: introduce adr_l, ldr_l and str_l macros") Signed-off-by: Julien Grall Reviewed-by: Bertrand Marquis Reviewed-by: Wei Chen ---- I haven't added an Origin tag because this is quite different from the Linux commit. I am happy to add one if this is desired.. --- xen/arch/arm/arm32/head.S | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S index 50f6fa4eb38d..27d02ac8d68f 100644 --- a/xen/arch/arm/arm32/head.S +++ b/xen/arch/arm/arm32/head.S @@ -49,20 +49,16 @@ .endm =20 /* - * There are no easy way to have a PC relative address within the range - * +/- 4GB of the PC. + * Pseudo-op for PC relative adr , where is + * within the range +/- 4GB of the PC. * - * This macro workaround it by asking the user to tell whether the MMU - * has been turned on or not. - * - * When the MMU is turned off, we need to apply the physical offset - * (r10) in order to find the associated physical address. + * @dst: destination register + * @sym: name of the symbol */ -.macro adr_l, dst, sym, mmu - ldr \dst, =3D\sym - .if \mmu =3D=3D 0 - add \dst, \dst, r10 - .endif +.macro adr_l, dst, sym + mov_w \dst, \sym - .Lpc\@ + .set .Lpc\@, .+ 8 /* PC bias */ + add \dst, \dst, pc .endm =20 .macro load_paddr rb, sym @@ -383,7 +379,6 @@ ENDPROC(cpu_init) * tbl: table symbol to point to * virt: virtual address * lvl: page-table level - * mmu: Is the MMU turned on/off. If not specified it will be off * * Preserves \virt * Clobbers r1 - r4 @@ -392,7 +387,7 @@ ENDPROC(cpu_init) * * Note that \virt should be in a register other than r1 - r4 */ -.macro create_table_entry, ptbl, tbl, virt, lvl, mmu=3D0 +.macro create_table_entry, ptbl, tbl, virt, lvl get_table_slot r1, \virt, \lvl /* r1 :=3D slot in \tlb */ lsl r1, r1, #3 /* r1 :=3D slot offset in \tlb */ =20 @@ -402,7 +397,7 @@ ENDPROC(cpu_init) orr r2, r2, r4 /* + \tlb paddr */ mov r3, #0 =20 - adr_l r4, \ptbl, \mmu + adr_l r4, \ptbl =20 strd r2, r3, [r4, r1] .endm @@ -415,17 +410,14 @@ ENDPROC(cpu_init) * virt: virtual address * phys: physical address * type: mapping type. If not specified it will be normal memory (PT_ME= M_L3) - * mmu: Is the MMU turned on/off. If not specified it will be off * * Preserves \virt, \phys * Clobbers r1 - r4 * - * * Also use r10 for the phys offset. - * * Note that \virt and \paddr should be in other registers than r1 - r4 * and be distinct. */ -.macro create_mapping_entry, ptbl, virt, phys, type=3DPT_MEM_L3, mmu=3D0 +.macro create_mapping_entry, ptbl, virt, phys, type=3DPT_MEM_L3 mov_w r2, XEN_PT_LPAE_ENTRY_MASK lsr r1, \virt, #THIRD_SHIFT and r1, r1, r2 /* r1 :=3D slot in \tlb */ @@ -438,7 +430,7 @@ ENDPROC(cpu_init) orr r2, r2, r4 /* + PAGE_ALIGNED(phys) */ mov r3, #0 =20 - adr_l r4, \ptbl, \mmu + adr_l r4, \ptbl =20 strd r2, r3, [r4, r1] .endm @@ -468,7 +460,7 @@ create_page_tables: create_table_entry boot_second, boot_third, r0, 2 =20 /* Setup boot_third: */ - adr_l r4, boot_third, mmu=3D0 + adr_l r4, boot_third =20 lsr r2, r9, #THIRD_SHIFT /* Base address for 4K mapping */ lsl r2, r2, #THIRD_SHIFT @@ -632,11 +624,11 @@ setup_fixmap: #if defined(CONFIG_EARLY_PRINTK) /* Add UART to the fixmap table */ ldr r0, =3DEARLY_UART_VIRTUAL_ADDRESS - create_mapping_entry xen_fixmap, r0, r11, type=3DPT_DEV_L3, mmu=3D1 + create_mapping_entry xen_fixmap, r0, r11, type=3DPT_DEV_L3 #endif /* Map fixmap into boot_second */ mov_w r0, FIXMAP_ADDR(0) - create_table_entry boot_second, xen_fixmap, r0, 2, mmu=3D1 + create_table_entry boot_second, xen_fixmap, r0, 2 /* Ensure any page table updates made above have occurred. */ dsb nshst =20 --=20 2.37.1 From nobody Fri May 17 11:58:59 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=1660332334; cv=none; d=zohomail.com; s=zohoarc; b=nq9v1FfKDfbafcbPdMj8HGVMCAVkkI86Q+UCWuZ36N3yRI2XSkUuMh3nGT2IVI3xnWJRzrBI1Ex7NNtXUUrjQc8XJDsIUxzGicoPiyvw13h4Ugf2zIpyqhu7h1Wt8zxPSXuP49DWF/MeclH/FR/4uVI0cPYtGtvU8tkEEmKagBw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660332334; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KSNSRhk/b7PF+Veoqw2eqLMcjCDzJVoJhlmghRfM920=; b=JKRrCkQ74t8cUvJ5ymB76Gmngs3uTXyaImr71olYRQQrEUi1YhBEtI5daINPraMB7tn/QzjLf0StSNlIjjM0Xt9lj0xGuqomTv5PoLy/CWgb0UR6XN7N/P9S3jlPwvmr38LzM2kBVDrdjlL5FTVTwCTtY8AAFXVJYrxt1VmBJOs= 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 1660332334748502.243196183618; Fri, 12 Aug 2022 12:25:34 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.385860.621683 (Exim 4.92) (envelope-from ) id 1oMaHT-0001cI-KC; Fri, 12 Aug 2022 19:25:15 +0000 Received: by outflank-mailman (output) from mailman id 385860.621683; Fri, 12 Aug 2022 19:25: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 1oMaHT-0001bf-CH; Fri, 12 Aug 2022 19:25:15 +0000 Received: by outflank-mailman (input) for mailman id 385860; Fri, 12 Aug 2022 19:25:13 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMaHR-0001CF-BA for xen-devel@lists.xenproject.org; Fri, 12 Aug 2022 19:25:13 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMaHR-0000yS-13; Fri, 12 Aug 2022 19:25:13 +0000 Received: from 54-240-197-224.amazon.com ([54.240.197.224] helo=dev-dsk-jgrall-1b-035652ec.eu-west-1.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oMaHQ-0006n6-PT; Fri, 12 Aug 2022 19:25:12 +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" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=KSNSRhk/b7PF+Veoqw2eqLMcjCDzJVoJhlmghRfM920=; b=ZCkoDm+ZTirO4BNHjMNk5xuq33 f3rtyXAH3xWYCjq79zyYeHN2QV+2yLqY6vW97Eu3JLKvZnY8hFYAFlnUO84vIXG3hmy+zt+pYG84p JnLwH6tMPpXjgCHTrYAZ3AgMerdBr8qCs382VleKjRokRwzoeBp0Xn7ubJG9iGjpm3tg=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: julien@xen.org, Julien Grall , Stefano Stabellini , Bertrand Marquis , Volodymyr Babchuk Subject: [PATCH 5/7] xen/arm32: head: Move earlyprintk messages to .rodata.str Date: Fri, 12 Aug 2022 20:24:44 +0100 Message-Id: <20220812192448.43016-6-julien@xen.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220812192448.43016-1-julien@xen.org> References: <20220812192448.43016-1-julien@xen.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @xen.org) X-ZM-MESSAGEID: 1660332336452100011 Content-Type: text/plain; charset="utf-8" From: Julien Grall At the moment, the strings are in text right after each use because the instruction 'adr' has specific requirement on the location and the compiler will forbid cross section label. The macro 'adr_l' was recently reworked so the caller doesn't need to know whether the MMU is on. This makes it easier to use where instructions can be run in both context. This also means that the strings don't need to be part of .text anymore. So move them to .rodata.str. Signed-off-by: Julien Grall Reviewed-by: Bertrand Marquis Reviewed-by: Jiamei Xie Reviewed-by: Wei Chen Tested-by: Bertrand Marquis --- xen/arch/arm/arm32/head.S | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S index 27d02ac8d68f..a558c2a6876e 100644 --- a/xen/arch/arm/arm32/head.S +++ b/xen/arch/arm/arm32/head.S @@ -93,13 +93,10 @@ */ #define PRINT(_s) \ mov r3, lr ;\ - adr r0, 98f ;\ + adr_l r0, 98f ;\ bl puts ;\ mov lr, r3 ;\ - b 99f ;\ -98: .asciz _s ;\ - .align 2 ;\ -99: + RODATA_STR(98, _s) =20 /* * Macro to print the value of register \rb @@ -736,7 +733,7 @@ ENDPROC(puts) * Clobbers r0-r3 */ putn: - adr r1, hex + adr_l r1, hex mov r3, #8 1: early_uart_ready r11, r2 @@ -749,8 +746,7 @@ putn: mov pc, lr ENDPROC(putn) =20 -hex: .ascii "0123456789abcdef" - .align 2 +RODATA_STR(hex, "0123456789abcdef") =20 #else /* CONFIG_EARLY_PRINTK */ =20 --=20 2.37.1 From nobody Fri May 17 11:58:59 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=1660332335; cv=none; d=zohomail.com; s=zohoarc; b=e+QXl1+PC8jvydDycASLehjrIsxoQOrmpCkTCoPI47jGO+01b3AtSmZYH86vaDb0oXXXHdWh3knTq2y4nnI3aDlGHkykZNgq+Tf4xvr/qbabbRiss0Nq0Vw2IQhzuGCYW3ASjsnM3fVC8p8+dd2RgAt0+7mk7VMvSiE5fabPHiE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660332335; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eGtlPOnezZCPLrLes6dERbD5TA/IOWPTENXfEX+3CEs=; b=IO+C+XYQF+Ex/b6M+KHSVrxnqHzGRzdYOLBtxXHbsF0GleMCNCUy0QcWMQp8FAogYoCSkqxQteH0GwHIKT7kw0ymtxoPAFQElMTmu69/8izXM96DG4nKoHc79+NFlxXvp2mG6ohCSowQnxnijDeH3Bu/8ShlkI9SqqODDuRP/1Y= 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 1660332335468282.8802085180464; Fri, 12 Aug 2022 12:25:35 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.385862.621688 (Exim 4.92) (envelope-from ) id 1oMaHU-0001hU-5n; Fri, 12 Aug 2022 19:25:16 +0000 Received: by outflank-mailman (output) from mailman id 385862.621688; Fri, 12 Aug 2022 19:25:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMaHT-0001fu-Sf; Fri, 12 Aug 2022 19:25:15 +0000 Received: by outflank-mailman (input) for mailman id 385862; Fri, 12 Aug 2022 19:25:15 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMaHT-0001Zh-43 for xen-devel@lists.xenproject.org; Fri, 12 Aug 2022 19:25:15 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMaHS-0000yh-2I; Fri, 12 Aug 2022 19:25:14 +0000 Received: from 54-240-197-224.amazon.com ([54.240.197.224] helo=dev-dsk-jgrall-1b-035652ec.eu-west-1.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oMaHR-0006n6-Qr; Fri, 12 Aug 2022 19:25: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" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=eGtlPOnezZCPLrLes6dERbD5TA/IOWPTENXfEX+3CEs=; b=6Te1Jx2dnT6deYglAWnLaUUau3 U/r15cOgOvWaXvMcF/a2mzL/7pyf8Rm4JGqCykyoOIXjqAcwWlGqtMDz0XdHLsceAKfT3bkQYD4v0 uOATOoul/JA3wyyWq3riti4jsIA1JPT+uXkQirm1j/5103YUwlLmCN5N5xgc4mu1b0NM=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: julien@xen.org, Julien Grall , Stefano Stabellini , Bertrand Marquis , Volodymyr Babchuk Subject: [PATCH 6/7] xen/arm: Tweak the dump page-table walk output Date: Fri, 12 Aug 2022 20:24:45 +0100 Message-Id: <20220812192448.43016-7-julien@xen.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220812192448.43016-1-julien@xen.org> References: <20220812192448.43016-1-julien@xen.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @xen.org) X-ZM-MESSAGEID: 1660332336464100013 Content-Type: text/plain; charset="utf-8" From: Julien Grall Currently the output is looking like: (XEN) 1ST[0x1] =3D 0x000000004015ff7f (XEN) 2ND[0x1f] =3D 0x00500000bfe00f7d The content of the entries are not aligned making a bit trickier to read (I appreciate this is a matter of taste). Align the values by forcing the index to be always printed using 3 characters (enough to cover 512 in hexadecimal). New output: (XEN) 1ST[0x001] =3D 0x000000004015ff7f (XEN) 2ND[0x01f] =3D 0x00500000bfe00f7d Signed-off-by: Julien Grall Reviewed-by: Bertrand Marquis Reviewed-by: Henry Wang --- xen/arch/arm/mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index b42cddb1b446..c81c706c8b23 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -234,7 +234,7 @@ void dump_pt_walk(paddr_t ttbr, paddr_t addr, =20 pte =3D mapping[offsets[level]]; =20 - printk("%s[0x%x] =3D 0x%"PRIpaddr"\n", + printk("%s[0x%03x] =3D 0x%"PRIpaddr"\n", level_strs[level], offsets[level], pte.bits); =20 if ( level =3D=3D 3 || !pte.walk.valid || !pte.walk.table ) --=20 2.37.1 From nobody Fri May 17 11:58:59 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=1660332336; cv=none; d=zohomail.com; s=zohoarc; b=QQL7CGALv1L8hjzTsFc3aS1VBGOFDsEmWZNb41Cy3M6Z10FWK9+ex0YzNnwGf2Wq+fy50odW7unPOY3WamP70r0r6/M10WV5zhPLasrfY8CTbl5dJ1eLTTrmebC2MunrY1vfp/rZ0IdEqL6JWNR8rERuq3JLgXq2cWXvDPnO/oc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660332336; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=N0+B5XI5k/0P7I6pJAFTgtxvabGcKL0aymNxJrmp098=; b=B6Wf74C26noinoV0BAdHM7xM9QjO4H6wfwZHARxc+hrWla8ZcZASmcRcDWzIu0lzpuCE3LtlipEgwd22wsmFC07bjSj2zz5Zz9HUWfbkAk9cDYWfw4T4QV90+giamT8E0MYvSsYCOa7FAewQ3p6N/5ExN7zJW/S7ZwwU+hxQZnc= 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 166033233634161.815311061709394; Fri, 12 Aug 2022 12:25:36 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.385863.621701 (Exim 4.92) (envelope-from ) id 1oMaHV-00026p-RX; Fri, 12 Aug 2022 19:25:17 +0000 Received: by outflank-mailman (output) from mailman id 385863.621701; Fri, 12 Aug 2022 19:25: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 1oMaHV-00025t-Fv; Fri, 12 Aug 2022 19:25:17 +0000 Received: by outflank-mailman (input) for mailman id 385863; Fri, 12 Aug 2022 19:25:15 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMaHT-0001c6-Cy for xen-devel@lists.xenproject.org; Fri, 12 Aug 2022 19:25:15 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMaHT-0000yr-3l; Fri, 12 Aug 2022 19:25:15 +0000 Received: from 54-240-197-224.amazon.com ([54.240.197.224] helo=dev-dsk-jgrall-1b-035652ec.eu-west-1.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oMaHS-0006n6-SF; Fri, 12 Aug 2022 19:25:15 +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" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=N0+B5XI5k/0P7I6pJAFTgtxvabGcKL0aymNxJrmp098=; b=7DIcsA5igRjgb1+LpFavAWnCwf wBTHUqkSDjwyxf9Xaylx9d33crE1BD4l1az20wETg1Ik5LUi85syQEujQh5AXegA7kgzuHIDIIveJ PWUdDnq80nOUhbGp6YcbBvpdOjiDc8ExeqedyidYHN67sxCuQfPHlwCcSonFdbAc1/Hg=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: julien@xen.org, Julien Grall , Stefano Stabellini , Bertrand Marquis , Volodymyr Babchuk Subject: [PATCH 7/8] patch arm32-tweak-enable-mmu.patch Date: Fri, 12 Aug 2022 20:24:46 +0100 Message-Id: <20220812192448.43016-8-julien@xen.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220812192448.43016-1-julien@xen.org> References: <20220812192448.43016-1-julien@xen.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @xen.org) X-ZM-MESSAGEID: 1660332338528100018 Content-Type: text/plain; charset="utf-8" From: Julien Grall --- xen/arch/arm/arm32/head.S | 50 +++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S index a558c2a6876e..a914ffab98a5 100644 --- a/xen/arch/arm/arm32/head.S +++ b/xen/arch/arm/arm32/head.S @@ -167,19 +167,12 @@ past_zImage: bl check_cpu_mode bl cpu_init bl create_page_tables - bl enable_mmu =20 - /* We are still in the 1:1 mapping. Jump to the runtime Virtual Ad= dress. */ - ldr r0, =3Dprimary_switched - mov pc, r0 + /* Address in the runtime mapping to jump to after the MMU is enab= led */ + mov_w lr, primary_switched + b enable_mmu + primary_switched: - /* - * The 1:1 map may clash with other parts of the Xen virtual memory - * layout. As it is not used anymore, remove it completely to - * avoid having to worry about replacing existing mapping - * afterwards. - */ - bl remove_identity_mapping bl setup_fixmap #ifdef CONFIG_EARLY_PRINTK /* Use a virtual address to access the UART. */ @@ -223,12 +216,10 @@ GLOBAL(init_secondary) bl check_cpu_mode bl cpu_init bl create_page_tables - bl enable_mmu - =20 - /* We are still in the 1:1 mapping. Jump to the runtime Virtual Ad= dress. */ - ldr r0, =3Dsecondary_switched - mov pc, r0 + /* Address in the runtime mapping to jump to after the MMU is enab= led */ + mov_w lr, secondary_switched + b enable_mmu secondary_switched: /* * Non-boot CPUs need to move on to the proper pagetables, which w= ere @@ -523,9 +514,11 @@ virtphys_clash: ENDPROC(create_page_tables) =20 /* - * Turn on the Data Cache and the MMU. The function will return on the 1:1 - * mapping. In other word, the caller is responsible to switch to the runt= ime - * mapping. + * Turn on the Data Cache and the MMU. The function will return + * to the virtual address provided in LR (e.g. the runtime mapping). + * + * Inputs: + * lr : Virtual address to return to * * Clobbers r0 - r3 */ @@ -551,7 +544,24 @@ enable_mmu: dsb /* Flush PTE writes and finish reads = */ mcr CP32(r0, HSCTLR) /* now paging is enabled */ isb /* Now, flush the icache */ - mov pc, lr + + /* + * The MMU is turned on and we are in the 1:1 mapping. Switch + * to the runtime mapping. + */ + mov_w r0, 1f + mov pc, r0 +1: + /* + * The 1:1 map may clash with other parts of the Xen virtual memory + * layout. As it is not used anymore, remove it completely to + * avoid having to worry about replacing existing mapping + * afterwards. + * + * On return this will jump to the virtual address requested by + * the caller. + */ + b remove_identity_mapping ENDPROC(enable_mmu) =20 /* --=20 2.37.1 From nobody Fri May 17 11:58:59 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=1660332334; cv=none; d=zohomail.com; s=zohoarc; b=F+Rgu/pzBJOK8uqakCPgv653QuaPbpnILLlEJG8H+aaVBQJrvwlmmOYkBUsCn/fzmt2Syp13OeVXOIuXy6dGY8ok1d+oL9qxtvJ8jNQyNDP/AyYE5T1bxK8+w1mHczsPcKiK5o5hJbYloUnsDfHz7YdSi0thCqQk4hNgVxMqvdE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660332334; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iOLL1u2KoKBoa80MrMv6wujMJrVVx1Fxvbp2RjO3MMA=; b=eiwVP4BMdGeAwJ5fpMxOF8ypcfs0K19QZ+hC1RQRMGwsXJ7i1QE42PEx80vMqKTl6W9NGWodxpu0j4Iop7ElYVxckG9+B7jJmG4I+Ok5m0Y1eL4d27mFDVats0sHW3nB7PFSwgX7Sg4pqGmAo39KpfmqC9letx0pKNDsl5aUfsY= 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 166033233402573.4998795822396; Fri, 12 Aug 2022 12:25:34 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.385864.621704 (Exim 4.92) (envelope-from ) id 1oMaHW-0002Au-6j; Fri, 12 Aug 2022 19:25:18 +0000 Received: by outflank-mailman (output) from mailman id 385864.621704; Fri, 12 Aug 2022 19:25:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMaHV-00029I-UC; Fri, 12 Aug 2022 19:25:17 +0000 Received: by outflank-mailman (input) for mailman id 385864; Fri, 12 Aug 2022 19:25:16 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMaHU-0001lw-8p for xen-devel@lists.xenproject.org; Fri, 12 Aug 2022 19:25:16 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMaHU-0000z9-5C; Fri, 12 Aug 2022 19:25:16 +0000 Received: from 54-240-197-224.amazon.com ([54.240.197.224] helo=dev-dsk-jgrall-1b-035652ec.eu-west-1.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oMaHT-0006n6-Te; Fri, 12 Aug 2022 19:25: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" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=iOLL1u2KoKBoa80MrMv6wujMJrVVx1Fxvbp2RjO3MMA=; b=f5qp8btfoRdImdkDqASaD7T85+ yj990o51158GqrHmrDZEDwMYd1ULtU8pkzcJy8NYeBrBcAqCHX3Ts2p1Ppw1jdv9HR+lu0EnvdCyQ 5PcKIr3v5TTdAk08OjvcQRJHoNGhxzUHr1bGhTYzlhBzSN8nxjnY4wQTAlIzTm7z5hMM=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: julien@xen.org, Julien Grall , Stefano Stabellini , Bertrand Marquis , Volodymyr Babchuk Subject: [PATCH 7/7] xen/arm32: traps: Dump more information for hypervisor data abort Date: Fri, 12 Aug 2022 20:24:47 +0100 Message-Id: <20220812192448.43016-9-julien@xen.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220812192448.43016-1-julien@xen.org> References: <20220812192448.43016-1-julien@xen.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @xen.org) X-ZM-MESSAGEID: 1660332334611100003 Content-Type: text/plain; charset="utf-8" From: Julien Grall Unlike arm64, on arm32 there are no extra information dumped (e.g. page table walk) for hypervisor data abort. For data abort, the HSR will be set properly and so replace the call to do_unexpected_trap() with do_trap_hyp_sync() to dispatch the error. Signed-off-by: Julien Grall Reviewed-by: Bertrand Marquis Reviewed-by: Henry Wang --- xen/arch/arm/arm32/traps.c | 2 +- xen/arch/arm/include/asm/traps.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/arm32/traps.c b/xen/arch/arm/arm32/traps.c index a4ce2b92d904..a2fc1c22cbc9 100644 --- a/xen/arch/arm/arm32/traps.c +++ b/xen/arch/arm/arm32/traps.c @@ -81,7 +81,7 @@ void do_trap_data_abort(struct cpu_user_regs *regs) if ( VABORT_GEN_BY_GUEST(regs) ) do_trap_guest_serror(regs); else - do_unexpected_trap("Data Abort", regs); + do_trap_hyp_sync(regs); } =20 void finalize_instr_emulation(const struct instr_details *instr) diff --git a/xen/arch/arm/include/asm/traps.h b/xen/arch/arm/include/asm/tr= aps.h index 08bc0b484c75..883dae368eac 100644 --- a/xen/arch/arm/include/asm/traps.h +++ b/xen/arch/arm/include/asm/traps.h @@ -73,6 +73,7 @@ int do_bug_frame(const struct cpu_user_regs *regs, vaddr_= t pc); =20 void noreturn do_unexpected_trap(const char *msg, const struct cpu_user_regs *regs); +void do_trap_hyp_sync(struct cpu_user_regs *regs); =20 /* Functions for pending virtual abort checking window. */ void abort_guest_exit_start(void); --=20 2.37.1 From nobody Fri May 17 11:58:59 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=1660332336; cv=none; d=zohomail.com; s=zohoarc; b=kwJC6fc9YYGi8Ll2S95EP3sR7RRB7AuvikiYu862nu8hZz6JxO/x/OLT7BV3CgNyI2j2df5/1x/RrLghn3Q5FayetZEMXuSNswd3G3UTS6OImz/QPtutIzqnRxu9ee++0GaYDDgAxg9SG7TE59FzD4mP6b5p7dpZ5h3FuSdryBM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660332336; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iOLL1u2KoKBoa80MrMv6wujMJrVVx1Fxvbp2RjO3MMA=; b=m1pD/Z2TTq92asTs3dkUNfXil2VrziEms8s+u3TiwZ0SUcTpFl+OC/tDfpP5UF03JMLKcYS4L6ALFR2+Q1en7vYAX/eoJeVTS+gGnoYd24Z4B69fPfvKMyYAviDdhSwxtvOP+bi5duoLZru4e3KwsWRvpOuTOvh+S7sTA5qGpUE= 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 166033233691019.640047354133117; Fri, 12 Aug 2022 12:25:36 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.385866.621719 (Exim 4.92) (envelope-from ) id 1oMaHY-0002bZ-2L; Fri, 12 Aug 2022 19:25:20 +0000 Received: by outflank-mailman (output) from mailman id 385866.621719; Fri, 12 Aug 2022 19:25:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMaHX-0002Yn-Iy; Fri, 12 Aug 2022 19:25:19 +0000 Received: by outflank-mailman (input) for mailman id 385866; Fri, 12 Aug 2022 19:25:17 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMaHV-00025p-CZ for xen-devel@lists.xenproject.org; Fri, 12 Aug 2022 19:25:17 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMaHV-0000zS-6d; Fri, 12 Aug 2022 19:25:17 +0000 Received: from 54-240-197-224.amazon.com ([54.240.197.224] helo=dev-dsk-jgrall-1b-035652ec.eu-west-1.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oMaHU-0006n6-V4; Fri, 12 Aug 2022 19:25:17 +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" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=iOLL1u2KoKBoa80MrMv6wujMJrVVx1Fxvbp2RjO3MMA=; b=HV8AcaitSCtPNQGvgTR11HlGYd zs8drn6eNZQeqwFDC9Jp9OYpQgzrYGxLlwpxRXyIXXxhM7VSKQcQHfVC7dsWS8tuSjIiRYVIIEyav dG1AYdqaFUi3rl/H1v+22NiLoB2NqPLwEZPN6Nl6QBtjVbMsNAWenMdlAlS6ElSrwPdk=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: julien@xen.org, Julien Grall , Stefano Stabellini , Bertrand Marquis , Volodymyr Babchuk Subject: [PATCH 8/8] xen/arm32: traps: Dump more information for hypervisor data abort Date: Fri, 12 Aug 2022 20:24:48 +0100 Message-Id: <20220812192448.43016-10-julien@xen.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220812192448.43016-1-julien@xen.org> References: <20220812192448.43016-1-julien@xen.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @xen.org) X-ZM-MESSAGEID: 1660332338513100017 Content-Type: text/plain; charset="utf-8" From: Julien Grall Unlike arm64, on arm32 there are no extra information dumped (e.g. page table walk) for hypervisor data abort. For data abort, the HSR will be set properly and so replace the call to do_unexpected_trap() with do_trap_hyp_sync() to dispatch the error. Signed-off-by: Julien Grall --- xen/arch/arm/arm32/traps.c | 2 +- xen/arch/arm/include/asm/traps.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/arm32/traps.c b/xen/arch/arm/arm32/traps.c index a4ce2b92d904..a2fc1c22cbc9 100644 --- a/xen/arch/arm/arm32/traps.c +++ b/xen/arch/arm/arm32/traps.c @@ -81,7 +81,7 @@ void do_trap_data_abort(struct cpu_user_regs *regs) if ( VABORT_GEN_BY_GUEST(regs) ) do_trap_guest_serror(regs); else - do_unexpected_trap("Data Abort", regs); + do_trap_hyp_sync(regs); } =20 void finalize_instr_emulation(const struct instr_details *instr) diff --git a/xen/arch/arm/include/asm/traps.h b/xen/arch/arm/include/asm/tr= aps.h index 08bc0b484c75..883dae368eac 100644 --- a/xen/arch/arm/include/asm/traps.h +++ b/xen/arch/arm/include/asm/traps.h @@ -73,6 +73,7 @@ int do_bug_frame(const struct cpu_user_regs *regs, vaddr_= t pc); =20 void noreturn do_unexpected_trap(const char *msg, const struct cpu_user_regs *regs); +void do_trap_hyp_sync(struct cpu_user_regs *regs); =20 /* Functions for pending virtual abort checking window. */ void abort_guest_exit_start(void); --=20 2.37.1