From nobody Mon Apr 29 18:36:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1579293795; cv=none; d=zohomail.com; s=zohoarc; b=dgzxNbrirXUD13MVpF0MlX1fRf8pel3ClDP7a23676sieASrvP85nqxRwVwC3NkLYIM5Yev9Ysw5HnhfsOR5dhUB0eXFKLfUJ7XOOEj7zlOZpnq+RpHxYExdJfgvksTOWNHYg8YPZ9cx7/eQ1SfgzEnaSERCEAGhMITbZI8uGQU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579293795; h=Content-Type: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=pUiu9gRI4lxOP9z+zD9gC8w+9owLiaps1tbVS2Db/Bk=; b=HV2HjxcXvDz6xhr/PYPMjrA06uk7k3UqXvQGRLT/LJsMAKBpxGTf6/wRaaFbeNIBBdihNi4czRXRhH0IPglcgBHZkubVcDrR3d9qs+fZbeKYbNpzM5ACebMyCpcT3HNSc3IVxcxbLlU78vircreDR7O8tg0eMKCnMGUd2bz4VcE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1579293795153544.5085434841284; Fri, 17 Jan 2020 12:43:15 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1isYS1-0004zk-JI; Fri, 17 Jan 2020 20:42:41 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1isYS0-0004yu-RD for xen-devel@lists.xenproject.org; Fri, 17 Jan 2020 20:42:40 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id df856c36-3969-11ea-9fd7-bc764e2007e4; Fri, 17 Jan 2020 20:42:27 +0000 (UTC) X-Inumbo-ID: df856c36-3969-11ea-9fd7-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1579293747; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oGgEPL6H4T/atSijyUJAoByln4PcK5zMY4BCVapfIJs=; b=V1/Ez/KwOuMQjfqHKITGxeZOSyqeV2jocqzb7DLZoey6pteimqs4GH1j o+vSB49fOWvIH54eYZda4nyCCOnKM/51d76q2qb/vbTWelqphj3jkMgRj RX0AGs1847mVAJum+zs9kI/BrNDdmaT4eqkrXD21YElsT8xXWuaNFPtr7 I=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: o4pF3YPvmxnMRGEVT7JubDEU6+MLx62FBx6XZuynb8yV12ZxZv1knYkJzpeSBDCwWA53WTguli EoQ3f8KvRY0fNhkhAejYujQcny8tnvFq//tzbLjOYdU9hiGrQAEw8+pdVxVDBAhdwgnsfT5TQW VfDolS1El2ymKZONKBOUcAaVj4vtAwRjmn5mepqEc1rqJ5iJyOmcNNWkjVgjTIgupGzDDUN3s/ iu9oKnFCoFyr5xqs5CDGky/1b6kg9b0aWuf2LpIGSWZGAi3hWZcWSWBLMQn0rQP+JVv9AzQKLK Eig= X-SBRS: 2.7 X-MesageID: 11526071 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,331,1574139600"; d="scan'208";a="11526071" From: Andrew Cooper To: Xen-devel Date: Fri, 17 Jan 2020 20:42:19 +0000 Message-ID: <20200117204223.30076-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200117204223.30076-1-andrew.cooper3@citrix.com> References: <20200117204223.30076-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 1/5] x86/boot: Create the l2_xenmap[] mappings dynamically X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The build-time construction of l2_xenmap[] imposes an arbitrary limit of 16M total, which is a limit looking to be lifted. Move l2_xenmap[] into the BSS, and adjust both the BIOS and EFI paths to fi= ll it in dynamically, based on the final linked size of Xen. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 v2: * Rewrite several comments --- xen/arch/x86/boot/head.S | 14 ++++++++++++++ xen/arch/x86/boot/x86_64.S | 23 ++++++++--------------- xen/arch/x86/efi/efi-boot.h | 14 ++++++++++++++ xen/arch/x86/xen.lds.S | 3 +++ 4 files changed, 39 insertions(+), 15 deletions(-) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index c5acbf56ae..ef9f562505 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -668,6 +668,20 @@ trampoline_setup: add %esi,sym_fs(__page_tables_start)-8(,%ecx,8) 2: loop 1b =20 + /* Map Xen into the higher mappings using 2M superpages. */ + lea _PAGE_PSE + PAGE_HYPERVISOR_RWX + sym_esi(_start), %eax + mov $sym_offs(_start), %ecx /* %eax =3D PTE to write ^ = */ + mov $sym_offs(_end - 1), %edx + shr $L2_PAGETABLE_SHIFT, %ecx /* %ecx =3D First slot to writ= e */ + shr $L2_PAGETABLE_SHIFT, %edx /* %edx =3D Final slot to writ= e */ + +1: mov %eax, sym_offs(l2_xenmap)(%esi, %ecx, 8) + add $1, %ecx + add $1 << L2_PAGETABLE_SHIFT, %eax + + cmp %edx, %ecx + jbe 1b + /* * Map Xen into the directmap (needed for early-boot pagetable * handling/walking), and identity map Xen into bootmap (needed for diff --git a/xen/arch/x86/boot/x86_64.S b/xen/arch/x86/boot/x86_64.S index aabf561b23..e63bece460 100644 --- a/xen/arch/x86/boot/x86_64.S +++ b/xen/arch/x86/boot/x86_64.S @@ -43,6 +43,14 @@ multiboot_ptr: GLOBAL(stack_start) .quad cpu0_stack + STACK_SIZE - CPUINFO_sizeof =20 + .section .bss.page_aligned, "aw", @nobits + .align PAGE_SIZE, 0 + +/* L2 mapping the Xen text/data/bss region. Uses 1x 4k page. */ +GLOBAL(l2_xenmap) + .fill L2_PAGETABLE_ENTRIES, 8, 0 + .size l2_xenmap, . - l2_xenmap + .section .data.page_aligned, "aw", @progbits .align PAGE_SIZE, 0 /* @@ -80,21 +88,6 @@ GLOBAL(l2_directmap) .fill 4 * L2_PAGETABLE_ENTRIES - 1, 8, 0 .size l2_directmap, . - l2_directmap =20 -/* - * L2 mapping the 1GB Xen text/data/bss region. At boot it maps 16MB from - * __image_base__, and is modified when Xen relocates itself. Uses 1x 4k - * page. - */ -GLOBAL(l2_xenmap) - .quad 0 - idx =3D 1 - .rept 7 - .quad sym_offs(__image_base__) + (idx << L2_PAGETABLE_SHIFT) + (PA= GE_HYPERVISOR_RWX | _PAGE_PSE) - idx =3D idx + 1 - .endr - .fill L2_PAGETABLE_ENTRIES - 8, 8, 0 - .size l2_xenmap, . - l2_xenmap - /* L2 mapping the fixmap. Uses 1x 4k page. */ l2_fixmap: idx =3D 0 diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index 50d1499867..ce07aedf45 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -585,6 +585,20 @@ static void __init efi_arch_memory_setup(void) if ( !efi_enabled(EFI_LOADER) ) return; =20 + /* + * Map Xen into the higher mappings, using 2M superpages. + * + * NB: We are currently in physical mode, so a RIP-relative relocation + * against _start/_end result in our arbitrary placement by the bootlo= ader + * in memory, rather than the intended high mappings position. Subtra= ct + * xen_phys_start to get the appropriate slots in l2_xenmap[]. + */ + for ( i =3D l2_table_offset((UINTN)_start - xen_phys_start); + i <=3D l2_table_offset((UINTN)_end - 1 - xen_phys_start); ++i ) + l2_xenmap[i] =3D + l2e_from_paddr(xen_phys_start + (i << L2_PAGETABLE_SHIFT), + PAGE_HYPERVISOR_RWX | _PAGE_PSE); + /* Check that there is at least 4G of mapping space in l2_*map[] */ BUILD_BUG_ON((sizeof(l2_bootmap) / L2_PAGETABLE_ENTRIES) < 4); BUILD_BUG_ON((sizeof(l2_directmap) / L2_PAGETABLE_ENTRIES) < 4); diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index 29ef507432..07c6448dbb 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -360,6 +360,9 @@ ASSERT(__2M_rwdata_end <=3D XEN_VIRT_END - XEN_VIRT_STA= RT + __XEN_VIRT_START - ASSERT(kexec_reloc_size - kexec_reloc <=3D PAGE_SIZE, "kexec_reloc is too = large") #endif =20 +/* The Multiboot setup paths relies on this to simplify superpage PTE crea= tion. */ +ASSERT(IS_ALIGNED(_start, MB(2)), "_start misaligned") + ASSERT(IS_ALIGNED(__2M_text_end, SECTION_ALIGN), "__2M_text_end misali= gned") ASSERT(IS_ALIGNED(__2M_rodata_start, SECTION_ALIGN), "__2M_rodata_start mi= saligned") ASSERT(IS_ALIGNED(__2M_rodata_end, SECTION_ALIGN), "__2M_rodata_end misa= ligned") --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Mon Apr 29 18:36:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1579293785; cv=none; d=zohomail.com; s=zohoarc; b=TlXTQCG6u/Gss7nQsDsojnHFrJnYj9nSEfCKDIEmZ2R24t2ccm+MXVfPSaDwCLMsprsDogotAWJWzMA1Vldo5GugmdG80hASQ/ysvao6PkjjVZyDzHMp6BTR0CDEXgBM0NpkKczPZluymWkAo0ztjj7RH94OUTt+dzuRxeCo1Sc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579293785; h=Content-Type: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=uf6jcr/gFzCCcsSnqhMS86wPXxhaX2n/GaOGTLloBZQ=; b=WrtT3VsTKfvvsjEKd7L/Sd9gqRcDOBIgPrCoJzyqJ33lKdLw90Zxzfz0/ykcflL3UCerlK0PCDW2PZd/hA4WjLbConpYX4alrGPRAbOzTjGC/W4R4p0TOPuyXfPeEx9psBAPL7BcNQn7ndv0PWoMgIZGGJ+Wvo095j7fGSXgUM4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1579293785276843.3547449839165; Fri, 17 Jan 2020 12:43:05 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1isYRs-0004vO-0Z; Fri, 17 Jan 2020 20:42:32 +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.89) (envelope-from ) id 1isYRq-0004uz-0X for xen-devel@lists.xenproject.org; Fri, 17 Jan 2020 20:42:30 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id dfbc0c14-3969-11ea-b618-12813bfff9fa; Fri, 17 Jan 2020 20:42:28 +0000 (UTC) X-Inumbo-ID: dfbc0c14-3969-11ea-b618-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1579293748; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fpCO0ehVSAQgDjvhHyCszFmIE7gcwm29q8mHr7AMMDk=; b=bUjK78HD2UHlkh0o5dNI4+bJKXHoi+ugJVAFTiEBZxXXH3qgV/fgB0Yr D+DwbkXd+7yy9Aba2V24QD8lr2VSlFOiagJp+DDhfYeZcUWzxU65SDq0w RO99qqGf2cYaS3x6EHGj4n39DbgWXqbkleapOwHVAnlAj1Lv6tpKT7PuR Q=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 7gCKtV2y8COdvzMRWJ2BKsyxla/KMiosFxoQp+NXQw1ri7I3yKjYD4fWqjRmgCDcHFMxbNn9G2 Dh2npbjnT7ybROGhee6TXXs3CBju0VGzDFCXxnyw9SXROZqMBBTvfF7fcxt6EMc6PB33blHy5I xwolFk8pUByaXTrheWiE/dZoDDfidMLiLmmjjnXbI7gN1y5pnu/rzkhBGIUFk90Wxe9Hfihn5+ vyIZAmRq/DZPlEgDBPbmS18AC3H8C/3oYRPdSJtyT60ffWFmn8re+W8mxif8tg0wAs3d721vTm 1I0= X-SBRS: 2.7 X-MesageID: 11688713 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,331,1574139600"; d="scan'208";a="11688713" From: Andrew Cooper To: Xen-devel Date: Fri, 17 Jan 2020 20:42:20 +0000 Message-ID: <20200117204223.30076-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200117204223.30076-1-andrew.cooper3@citrix.com> References: <20200117204223.30076-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 2/5] x86/boot: Size the boot/directmap mappings dynamically X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) ... rather than presuming that 16M will do. On the EFI side, use l2e_add_flags() to reduce the code-generation overhead of using l2e_from_paddr() twice. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 v2: * Drop adjustment to the linker script. There are more 16M issues to find. --- xen/arch/x86/boot/head.S | 21 +++++++++++++-------- xen/arch/x86/efi/efi-boot.h | 23 ++++++++++++++++++----- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index ef9f562505..0137ee99a4 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -687,14 +687,19 @@ trampoline_setup: * handling/walking), and identity map Xen into bootmap (needed for * the transition into long mode), using 2M superpages. */ - lea sym_esi(start),%ebx - lea (1<> L2_PAGETABLE_SHIFT) & (4 * L2_PAGETABLE_ENTRIES - 1)) + + for ( i =3D l2_4G_offset(_start); + i <=3D l2_4G_offset(_end - 1); ++i ) { - unsigned int slot =3D (xen_phys_start >> L2_PAGETABLE_SHIFT) + i; - paddr_t addr =3D slot << L2_PAGETABLE_SHIFT; + l2_pgentry_t pte =3D l2e_from_paddr(i << L2_PAGETABLE_SHIFT, + __PAGE_HYPERVISOR | _PAGE_PSE); + + l2_bootmap[i] =3D pte; + + /* Bootmap RWX/Non-global. Directmap RW/Global. */ + l2e_add_flags(pte, PAGE_HYPERVISOR); =20 - l2_directmap[slot] =3D l2e_from_paddr(addr, PAGE_HYPERVISOR|_PAGE_= PSE); - l2_bootmap[slot] =3D l2e_from_paddr(addr, __PAGE_HYPERVISOR|_PAGE_= PSE); + l2_directmap[i] =3D pte; } +#undef l2_4G_offset } =20 static void __init efi_arch_handle_module(struct file *file, const CHAR16 = *name, --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Mon Apr 29 18:36:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1579293790; cv=none; d=zohomail.com; s=zohoarc; b=UBBePhrz35ocru2hkBM5isEXUiOB+n1RNsHVo0Y23LPVgGdgLR8Fh9a09OsxW/7f9HqRxDGXMQ3Opk13z+ZQGTz4xuGGnSlAvLSKXJ9PE0h6a1zkz39bS+m86E5KeRn70YjoY6MsTbgDp7WCSXPDLkHTsDRU1mYgyWzmHUusCg0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579293790; h=Content-Type: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=5EZ+NFfXPE6+KPEV9wXcKRhz1hVfwgmEd8GAyPOSnoI=; b=m82EaK+6FSILNnzcV+uXyl3x8SL24dxG4uNA4E2TdKfe1A8wS1L0WwJMoN7kpPrvi2L14h4BqTbrwV8wyH8tkIfEf6XPQxl7dNbdjaWxJxd+9zgzyUkse8APWBUnRDNhoa7WAa3TeILPuE8amo6imTeUvr4+YuSsGgLkK4+YfoM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1579293790060537.096769916256; Fri, 17 Jan 2020 12:43:10 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1isYRw-0004wZ-B6; Fri, 17 Jan 2020 20:42:36 +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.89) (envelope-from ) id 1isYRu-0004wB-TG for xen-devel@lists.xenproject.org; Fri, 17 Jan 2020 20:42:34 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id e0585092-3969-11ea-b618-12813bfff9fa; Fri, 17 Jan 2020 20:42:29 +0000 (UTC) X-Inumbo-ID: e0585092-3969-11ea-b618-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1579293749; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=peR5YpwnLucy99fGI8zjvLj+hucdOn9FmBcbB0UM/5w=; b=TS8NI0+IDbsG3dV87RKuHm2tz87BMjXqviN7HeuWBtsCoeWrSFqlPtcN aKIJOw2/R2fVkan3mB7JNPJNW6Svn35YjNVkRKC/qzrULw/53Zisg733G KLJLNIaGzPDixIqSDX8/RfcYVVSqhToAMk0b8sMDj+Pn8Xbh7cfrUMVfZ Y=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: DiPOMOLQgxIPkEuFWfcnQtAySzjfWX3Owbyr1cp01uAk8LGsUqgCOz+Q5g7LqtXH/c1zfpLL+x rfYPytEllzzmlu/SJaXN1ihjLbBrlqMusHgKmfw2iJ3J2j89gq1Zst0OObXOcF/tksw8VwrxOB orc/HMDGP8mJCRdcfa3kG+qdUTL7njZjy5LOHhc9V0y3W+fTfnNX40RNIKSLBvlEtkHRUD9v3r Y1qmMVAfnf1ENgmy6LresszYDWurTmQfacCDs0gGprsvi1qUya7Rl8d/6aSD7CwORAievfrwLb rM4= X-SBRS: 2.7 X-MesageID: 11688714 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,331,1574139600"; d="scan'208";a="11688714" From: Andrew Cooper To: Xen-devel Date: Fri, 17 Jan 2020 20:42:21 +0000 Message-ID: <20200117204223.30076-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200117204223.30076-1-andrew.cooper3@citrix.com> References: <20200117204223.30076-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 3/5] x86/boot: Drop explicit %fs uses X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The trampoline relocation code uses %fs for accessing Xen, and this comes w= ith an arbitrary 16M limitation. We could adjust the limit, but the boot code = is a confusing mix of %ds/%esi-based and %fs-based accesses, and the use of %fs is longer to encode, and incurs an address generation overhead. Rewrite the logic to use %ds, for better consistency with the surrounding code, and a marginal performance improvement. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/boot/head.S | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index 0137ee99a4..1deeae2f2a 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -718,23 +718,27 @@ trampoline_setup: mov %edx, sym_esi(l2_bootmap) =20 /* Apply relocations to bootstrap trampoline. */ - mov sym_fs(trampoline_phys),%edx - mov $sym_offs(__trampoline_rel_start),%edi + mov sym_esi(trampoline_phys), %edx + lea sym_esi(__trampoline_rel_start), %edi + lea sym_esi(__trampoline_rel_stop), %ecx 1: - mov %fs:(%edi),%eax - add %edx,%fs:(%edi,%eax) + mov (%edi), %eax + add %edx, (%edi, %eax) add $4,%edi - cmp $sym_offs(__trampoline_rel_stop),%edi + + cmp %ecx, %edi jb 1b =20 /* Patch in the trampoline segment. */ shr $4,%edx - mov $sym_offs(__trampoline_seg_start),%edi + lea sym_esi(__trampoline_seg_start), %edi + lea sym_esi(__trampoline_seg_stop), %ecx 1: - mov %fs:(%edi),%eax - mov %dx,%fs:(%edi,%eax) + mov (%edi), %eax + mov %dx, (%edi, %eax) add $4,%edi - cmp $sym_offs(__trampoline_seg_stop),%edi + + cmp %ecx, %edi jb 1b =20 /* Do not parse command line on EFI platform here. */ @@ -760,9 +764,9 @@ trampoline_setup: push %eax =20 /* Copy bootstrap trampoline to low memory, below 1MB. */ - mov $sym_offs(trampoline_start),%esi + lea sym_esi(trampoline_start), %esi mov $((trampoline_end - trampoline_start) / 4),%ecx - rep movsl %fs:(%esi),%es:(%edi) + rep movsl =20 /* Jump into the relocated trampoline. */ lret --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Mon Apr 29 18:36:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1579293801; cv=none; d=zohomail.com; s=zohoarc; b=DeOCcTuRvyFZVmIUTqfJQujch5EicL2Hb1U0gzuDHAUyU0h/7FRa/SZMDyETVGrQusr7uX4jfC/7HHpAWO0E3JQsbcNaQust2Qv01FhLK5KkD6E3i/lJkGIlSDv3VhYmByx4+uMWmKk3MVjB6gpUG/WhtSOklfxDfz0WhKL4Hx8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579293801; h=Content-Type: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=3GkiPLBTJptEd0tmdphExJWfPzCJHi0H3ARsaSN/HbQ=; b=iDs6nh/cCL6ytMlI3hYKI1/HNZfdFKedr3jSt8y3VfsL8voejIvX3WSeYfB5Ir9hLmwyAECoACAyvM27OxRaXPATN4APAct40+0JQW4mE+q7r9VGmPx+64m/KEEo7RKDgbJdvcg9FVilpgYTX+wT1kmsoKDcxoNPaQK8L7TsExQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1579293801492225.26024242337598; Fri, 17 Jan 2020 12:43:21 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1isYS5-00052g-Uv; Fri, 17 Jan 2020 20:42:45 +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.89) (envelope-from ) id 1isYS4-00052A-TQ for xen-devel@lists.xenproject.org; Fri, 17 Jan 2020 20:42:44 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id e0585094-3969-11ea-b618-12813bfff9fa; Fri, 17 Jan 2020 20:42:30 +0000 (UTC) X-Inumbo-ID: e0585094-3969-11ea-b618-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1579293749; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lwxbiIIphKzv7M1wucFaTA2yiLn6ylvMeg5ek0OqqtM=; b=NzTNjWKymJ77mAeZl/ylvSetxtWr/LYQM5x6LUXZ3uioOhEzCKqkTbkH 1KB33wZQ1hze/vzfom2yiLMYKTpPBn8iXE7phdbI2fs9J4yllWG4ViQRR Nxe/qdHtY3gHLtO+U7X0RYnwFXSJXEfA4jDFKPQyFYZFu63RovAtys9fN k=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: NLwMu/lyppxgkdJGGTHgvjEoNtuwpwzJF3kL6hqvEbMtp2L0BT4q3QBv4yHjnAm7JBtTyh2SMl QmYkEMEkM4oVPN/rhsGTmaFvF2xF8tQn1Ett7VclcRlQE49SJ6BlwWhf14H1TEn/v/2Dkko9DE Bt0HKkzoBcGuCvwyVAAzRpxFx+zX0CWmctP6kMysHbkEkZ+0/yxM5lxLWHv2nxTfiJm5MUS8WE zUMgdJkl9CDLLwOpiMmg3ztxm58xnOTVeB9OwA4lE0rHDhU5LdbyzzZbK7hSnohzoyX18KX28Q PlA= X-SBRS: 2.7 X-MesageID: 11688716 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,331,1574139600"; d="scan'208";a="11688716" From: Andrew Cooper To: Xen-devel Date: Fri, 17 Jan 2020 20:42:22 +0000 Message-ID: <20200117204223.30076-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200117204223.30076-1-andrew.cooper3@citrix.com> References: <20200117204223.30076-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 4/5] x86/boot: Simplify pagetable manipulation loops X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) For __page_tables_{start,end} and L3 bootmap initialisation, the logic is unnecesserily complicated owing to its attempt to use the LOOP instruction, which results in an off-by-8 memory address owing to LOOP's termination condition. Rewrite both loops for improved clarity and speed. Misc notes: * TEST $IMM, MEM can't macrofuse. The loop has 0x1200 iterations, so pull the $_PAGE_PRESENT constant out into a spare register to turn the TEST i= nto its %REG, MEM form, which can macrofuse. * Avoid the use of %fs-relative references. %esi-relative is the more com= mon form in the code, and doesn't suffer an address generation overhead. * Avoid LOOP. CMP/JB isn't microcoded and faster to execute in all cases. * For a 4 interation trivial loop, even compilers unroll these. The generated code size is a fraction larger, but this is init and the asm is far easier to follow. * Reposition the l2=3D>l1 bootmap construction so the asm reads in pagetab= le level order. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/boot/head.S | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index 1deeae2f2a..1acaf817ba 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -662,11 +662,17 @@ trampoline_setup: mov %edx,sym_fs(boot_tsc_stamp)+4 =20 /* Relocate pagetables to point at Xen's current location in memor= y. */ - mov $((__page_tables_end-__page_tables_start)/8),%ecx -1: testl $_PAGE_PRESENT,sym_fs(__page_tables_start)-8(,%ecx,8) + mov $_PAGE_PRESENT, %edx + lea sym_esi(__page_tables_start), %eax + lea sym_esi(__page_tables_end), %edi + +1: testb %dl, (%eax) /* if page present */ jz 2f - add %esi,sym_fs(__page_tables_start)-8(,%ecx,8) -2: loop 1b + add %esi, (%eax) /* pte +=3D base */ +2: add $8, %eax + + cmp %edi, %eax + jb 1b =20 /* Map Xen into the higher mappings using 2M superpages. */ lea _PAGE_PSE + PAGE_HYPERVISOR_RWX + sym_esi(_start), %eax @@ -701,22 +707,27 @@ trampoline_setup: cmp %edx, %ecx jbe 1b =20 - /* Initialize L3 boot-map page directory entries. */ - lea __PAGE_HYPERVISOR+(L2_PAGETABLE_ENTRIES*8)*3+sym_esi(l2_bo= otmap),%eax - mov $4,%ecx -1: mov %eax,sym_fs(l3_bootmap)-8(,%ecx,8) - sub $(L2_PAGETABLE_ENTRIES*8),%eax - loop 1b - - /* Map the permanent trampoline page into l{1,2}_bootmap[]. */ + /* Map 4x l2_bootmap[] into l3_bootmap[0...3] */ + lea __PAGE_HYPERVISOR + sym_esi(l2_bootmap), %eax + mov $PAGE_SIZE, %edx + mov %eax, 0 + sym_esi(l3_bootmap) + add %edx, %eax + mov %eax, 8 + sym_esi(l3_bootmap) + add %edx, %eax + mov %eax, 16 + sym_esi(l3_bootmap) + add %edx, %eax + mov %eax, 24 + sym_esi(l3_bootmap) + + /* Map l1_bootmap[] into l2_bootmap[0]. */ + lea __PAGE_HYPERVISOR + sym_esi(l1_bootmap), %eax + mov %eax, sym_esi(l2_bootmap) + + /* Map the permanent trampoline page into l1_bootmap[]. */ mov sym_esi(trampoline_phys), %ecx lea __PAGE_HYPERVISOR_RX(%ecx), %edx /* %edx =3D PTE to write = */ shr $PAGE_SHIFT, %ecx /* %ecx =3D Slot to write= */ mov %edx, sym_offs(l1_bootmap)(%esi, %ecx, 8) =20 - lea __PAGE_HYPERVISOR + sym_esi(l1_bootmap), %edx - mov %edx, sym_esi(l2_bootmap) - /* Apply relocations to bootstrap trampoline. */ mov sym_esi(trampoline_phys), %edx lea sym_esi(__trampoline_rel_start), %edi --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Mon Apr 29 18:36:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1579293797; cv=none; d=zohomail.com; s=zohoarc; b=CjWJjnoOdi/rWzDZLVEWsNRY/PseT8p9TjztWauB/nu5U/JZkiXbMnb3SHq39700WE33QDE96bEVW9whQV9pplSBA0+ictM4SkjQMk8Y9i4UALWHGnMXwfomQs0fncp1bjEma0bB/Xv70XWAdmLxfcphSHCjnls638kHmXg9qw8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579293797; h=Content-Type: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=T/hgITbfGaOLTPJ7LWh4Xm95f6IvOry/pCMX6YhD2rM=; b=eiyUO9LMQGDl+mp/6o2JYHjv/dB7ySOy1jM1ddyMEvuzUY7FiT90imHO4BQ5ih5qlgPNwq6/OGh+jTAX4pj6YVWoqZfaTRvb7b/BTBhvLWdIEFQ+3V+MJ0FudAb/Q8uyUtmdsMJ6dnqVd/PHXOnRtMUu0+iDumuiclwucwkvAKk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1579293797927854.0606645484986; Fri, 17 Jan 2020 12:43:17 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1isYS1-0004z2-0c; Fri, 17 Jan 2020 20:42:41 +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.89) (envelope-from ) id 1isYRz-0004yb-TZ for xen-devel@lists.xenproject.org; Fri, 17 Jan 2020 20:42:39 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id e10e6f1c-3969-11ea-b618-12813bfff9fa; Fri, 17 Jan 2020 20:42:29 +0000 (UTC) X-Inumbo-ID: e10e6f1c-3969-11ea-b618-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1579293749; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YBmap6C478XSgQIRF3uqTTI46EHEB9iCWn6tw5D2SFw=; b=VrhjcAgyId/UWgUlhiWWeVpcplCMMZRjDtrxCe7nW0ytRpniOhtaMRBx NkQz9c50ZqfUX0Pcn59bG/DHsCO0jtRlyys9Ltoqs2h5yi7LnMO/0MZKU +y1JhTu5hu5IdXZB6JocnVWdhWSk1/AIB/qb+kaAT4uDZNYaLEPDbh4S5 4=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: qlVCX4zCbpejCiZ7uewKx0osAQ0PwlNq9AU5tCfa9Eq2RXjiiKMnejJiJYWgYsD2Ozld69yaBU 0CygI8jR8Wnx6tNyNrC3ayHcMGuZ6snPf1ElogvUqtfOJ16/Q+PCH9v3TCX3dBORQnpQtBYxyO BOGKBDXx0vmv2Uu2rNxjIc3Lqam9wfbVR+hRBPPMhquFLyYeyOMaCLx6112TcV7LAqiUiXgZ4X oc/lZPQTNALRtV+R3JL7pQBTXxWuc3JosiVYy6QWJ2nT1yylecJwrn884lBFLllRt5Be3HIaT2 ew0= X-SBRS: 2.7 X-MesageID: 11688715 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,331,1574139600"; d="scan'208";a="11688715" From: Andrew Cooper To: Xen-devel Date: Fri, 17 Jan 2020 20:42:23 +0000 Message-ID: <20200117204223.30076-6-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200117204223.30076-1-andrew.cooper3@citrix.com> References: <20200117204223.30076-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 5/5] x86/boot: Drop sym_fs() X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) All remaining users of sym_fs() can trivially be switched to using sym_esi() instead. This is shorter to encode and faster to execute. This removes the final uses of %fs during boot, which allows us to drop BOOT_FS from the trampoline GDT, which drops an 16M arbitrary limit on Xen's compiled size. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/boot/head.S | 41 ++++++++++++++------------------------= --- xen/arch/x86/boot/trampoline.S | 1 - 2 files changed, 14 insertions(+), 28 deletions(-) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index 1acaf817ba..aea6744c80 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -14,14 +14,12 @@ =20 #define sym_offs(sym) ((sym) - __XEN_VIRT_START) #define sym_esi(sym) sym_offs(sym)(%esi) -#define sym_fs(sym) %fs:sym_offs(sym) =20 #define BOOT_CS32 0x0008 #define BOOT_CS64 0x0010 #define BOOT_DS 0x0018 #define BOOT_PSEUDORM_CS 0x0020 #define BOOT_PSEUDORM_DS 0x0028 -#define BOOT_FS 0x0030 =20 #define MB2_HT(name) (MULTIBOOT2_HEADER_TAG_##name) #define MB2_TT(name) (MULTIBOOT2_TAG_TYPE_##name) @@ -555,24 +553,13 @@ trampoline_bios_setup: trampoline_setup: /* * Called on legacy BIOS and EFI platforms. - * - * Set the BOOT_FS descriptor base address to %esi. */ - mov %esi, %edx - shr $16, %edx - mov %si, BOOT_FS + 2 + sym_esi(trampoline_gdt) /* Bits 0-15 */ - mov %dl, BOOT_FS + 4 + sym_esi(trampoline_gdt) /* Bits 16-23 */ - mov %dh, BOOT_FS + 7 + sym_esi(trampoline_gdt) /* Bits 24-31 */ - - /* Load %fs to allow for access to Xen data. */ - mov $BOOT_FS, %edx - mov %edx, %fs =20 /* Save Xen image load base address for later use. */ - mov %esi,sym_fs(xen_phys_start) - mov %esi,sym_fs(trampoline_xen_phys_start) + mov %esi, sym_esi(xen_phys_start) + mov %esi, sym_esi(trampoline_xen_phys_start) =20 - mov sym_fs(trampoline_phys),%ecx + mov sym_esi(trampoline_phys), %ecx =20 /* Get bottom-most low-memory stack address. */ add $TRAMPOLINE_SPACE,%ecx @@ -583,13 +570,13 @@ trampoline_setup: push %eax /* Magic number. */ call reloc #ifdef CONFIG_PVH_GUEST - cmpb $0, sym_fs(pvh_boot) + cmpb $0, sym_esi(pvh_boot) je 1f - mov %eax, sym_fs(pvh_start_info_pa) + mov %eax, sym_esi(pvh_start_info_pa) jmp 2f #endif 1: - mov %eax, sym_fs(multiboot_ptr) + mov %eax, sym_esi(multiboot_ptr) 2: =20 /* @@ -613,7 +600,7 @@ trampoline_setup: * Do not zero BSS on EFI platform here. * It was initialized earlier. */ - cmpb $0,sym_fs(efi_platform) + cmpb $0, sym_esi(efi_platform) jnz 1f =20 /* @@ -632,7 +619,7 @@ trampoline_setup: /* Interrogate CPU extended features via CPUID. */ mov $1, %eax cpuid - mov %ecx, sym_fs(boot_cpu_data) + CPUINFO_FEATURE_OFFSET(X86_F= EATURE_HYPERVISOR) + mov %ecx, CPUINFO_FEATURE_OFFSET(X86_FEATURE_HYPERVISOR) + sym= _esi(boot_cpu_data) =20 mov $0x80000000,%eax cpuid @@ -644,7 +631,7 @@ trampoline_setup: jbe 1f mov $0x80000001,%eax cpuid -1: mov %edx, sym_fs(boot_cpu_data) + CPUINFO_FEATURE_OFFSET(X86_F= EATURE_LM) +1: mov %edx, CPUINFO_FEATURE_OFFSET(X86_FEATURE_LM) + sym_esi(boo= t_cpu_data) =20 /* Check for NX. Adjust EFER setting if available. */ bt $cpufeat_bit(X86_FEATURE_NX), %edx @@ -658,8 +645,8 @@ trampoline_setup: =20 /* Stash TSC to calculate a good approximation of time-since-boot = */ rdtsc - mov %eax,sym_fs(boot_tsc_stamp) - mov %edx,sym_fs(boot_tsc_stamp)+4 + mov %eax, sym_esi(boot_tsc_stamp) + mov %edx, 4 + sym_esi(boot_tsc_stamp) =20 /* Relocate pagetables to point at Xen's current location in memor= y. */ mov $_PAGE_PRESENT, %edx @@ -753,11 +740,11 @@ trampoline_setup: jb 1b =20 /* Do not parse command line on EFI platform here. */ - cmpb $0,sym_fs(efi_platform) + cmpb $0, sym_esi(efi_platform) jnz 1f =20 /* Bail if there is no command line to parse. */ - mov sym_fs(multiboot_ptr),%ebx + mov sym_esi(multiboot_ptr), %ebx testl $MBI_CMDLINE,MB_flags(%ebx) jz 1f =20 @@ -768,7 +755,7 @@ trampoline_setup: =20 1: /* Switch to low-memory stack which lives at the end of trampoline= region. */ - mov sym_fs(trampoline_phys),%edi + mov sym_esi(trampoline_phys), %edi lea TRAMPOLINE_SPACE+TRAMPOLINE_STACK_SPACE(%edi),%esp lea trampoline_boot_cpu_entry-trampoline_start(%edi),%eax pushl $BOOT_CS32 diff --git a/xen/arch/x86/boot/trampoline.S b/xen/arch/x86/boot/trampoline.S index 6b403a6d1a..18c6638924 100644 --- a/xen/arch/x86/boot/trampoline.S +++ b/xen/arch/x86/boot/trampoline.S @@ -129,7 +129,6 @@ gdt_48: .quad 0x00cf93000000ffff /* 0x0018: ring 0 data */ .quad 0x00009b000000ffff /* 0x0020: real-mode code @ BOOT_TRAMPO= LINE */ .quad 0x000093000000ffff /* 0x0028: real-mode data @ BOOT_TRAMPO= LINE */ - .quad 0x00c0930000000fff /* 0x0030: ring 0 Xen data, 16M @ XEN */ .Ltrampoline_gdt_end: =20 /* Relocations for trampoline Real Mode segments. */ --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel