From patchwork Mon Jan 13 17:50:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 11330693 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1D96C1820 for ; Mon, 13 Jan 2020 17:51:35 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EADA8207FF for ; Mon, 13 Jan 2020 17:51:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="dWS5iSDL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EADA8207FF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ir3rM-0004mb-Mi; Mon, 13 Jan 2020 17:50:40 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ir3rL-0004m8-Dc for xen-devel@lists.xenproject.org; Mon, 13 Jan 2020 17:50:39 +0000 X-Inumbo-ID: 2d664d98-362d-11ea-ac27-bc764e2007e4 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 2d664d98-362d-11ea-ac27-bc764e2007e4; Mon, 13 Jan 2020 17:50:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1578937825; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TXNkkm1esllR1GPmBUZSnJSmYucTp7Ig+/pRyHAQEUM=; b=dWS5iSDLPXMbG9A7OSyr68tWZy/CfXepTv9Oic/YLyZidfQfGr+0DOeB iyIKt8QvA5WefaJBs9Y+GJK5n0na+SDvRPF6GC3qjXJMVp1nZebvlcGbL w9Cw1DcrEaubKmKEMaZ4RUHOiUcsBiBzypDdtxafJWoALErDVAYjVNeXa 8=; 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 (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: Ra6P98k+YyCVslSywp59yHtvVCN9JKT3eqyIVj/kBrWf7fwoIl9ZpxluL3ofbtFktG+okUZNel eNF0uM980o2R5gjwvnatGaz70sMeDkIvpu2NVn64TE2BVT5QLDDIedrFu56UiwMreBfSkeHv6r CBrzJ42YcoaV8tfLhMSzXDPwBBWyJi1o6Cw7tTYOe/sM6WapDBvwgpWJQFiZDX/R1iPO3gPIKt cMhFBT6fIPdQmXt/iGLe/Q/qcudkb/N8l+6Ssa9ScRqsPaKARnanTrFlyEWgdtA4HKe7O7zs+m SKw= X-SBRS: 2.7 X-MesageID: 11277185 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.69,429,1571716800"; d="scan'208";a="11277185" From: Andrew Cooper To: Xen-devel Date: Mon, 13 Jan 2020 17:50:18 +0000 Message-ID: <20200113175020.32730-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200113175020.32730-1-andrew.cooper3@citrix.com> References: <20200113175020.32730-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 2/4] x86/page: Remove bifurcated PAGE_HYPERVISOR constant 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_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Despite being vaguely aware, the difference between PAGE_HYPERVISOR in ASM and C code has nevertheless caused several bugs I should have known better about, and contributed to review confusion. There are exactly 4 uses of these constants in asm code (and one is shortly going to disappear). Instead of creating the constants which behave differently between ASM and C code, expose all the constants and use non-ambiguous non-NX ones in ASM. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monné --- xen/arch/x86/boot/head.S | 2 +- xen/arch/x86/boot/x86_64.S | 6 +++--- xen/include/asm-x86/x86_64/page.h | 7 ------- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index aaf0e119db..c5acbf56ae 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -674,7 +674,7 @@ trampoline_setup: * the transition into long mode), using 2M superpages. */ lea sym_esi(start),%ebx - lea (1<= 0xa0 && pfn < 0xc0 - .quad (pfn << PAGE_SHIFT) | PAGE_HYPERVISOR_UCMINUS | MAP_SMALL_PAGES + .quad (pfn << PAGE_SHIFT) | __PAGE_HYPERVISOR_UCMINUS | _PAGE_GLOBAL | MAP_SMALL_PAGES .else - .quad (pfn << PAGE_SHIFT) | PAGE_HYPERVISOR | MAP_SMALL_PAGES + .quad (pfn << PAGE_SHIFT) | PAGE_HYPERVISOR_RWX | MAP_SMALL_PAGES .endif pfn = pfn + 1 .endr @@ -89,7 +89,7 @@ GLOBAL(l2_xenmap) .quad 0 idx = 1 .rept 7 - .quad sym_offs(__image_base__) + (idx << L2_PAGETABLE_SHIFT) + (PAGE_HYPERVISOR | _PAGE_PSE) + .quad sym_offs(__image_base__) + (idx << L2_PAGETABLE_SHIFT) + (PAGE_HYPERVISOR_RWX | _PAGE_PSE) idx = idx + 1 .endr .fill L2_PAGETABLE_ENTRIES - 8, 8, 0 diff --git a/xen/include/asm-x86/x86_64/page.h b/xen/include/asm-x86/x86_64/page.h index 4fe0205553..1a4af85469 100644 --- a/xen/include/asm-x86/x86_64/page.h +++ b/xen/include/asm-x86/x86_64/page.h @@ -172,18 +172,11 @@ static inline intpte_t put_pte_flags(unsigned int x) #define PAGE_HYPERVISOR_RX (__PAGE_HYPERVISOR_RX | _PAGE_GLOBAL) #define PAGE_HYPERVISOR_RWX (__PAGE_HYPERVISOR | _PAGE_GLOBAL) -#ifdef __ASSEMBLY__ -/* Dependency on NX being available can't be expressed. */ -# define PAGE_HYPERVISOR PAGE_HYPERVISOR_RWX -# define PAGE_HYPERVISOR_UCMINUS (__PAGE_HYPERVISOR_UCMINUS | _PAGE_GLOBAL) -# define PAGE_HYPERVISOR_UC (__PAGE_HYPERVISOR_UC | _PAGE_GLOBAL) -#else # define PAGE_HYPERVISOR PAGE_HYPERVISOR_RW # define PAGE_HYPERVISOR_UCMINUS (__PAGE_HYPERVISOR_UCMINUS | \ _PAGE_GLOBAL | _PAGE_NX) # define PAGE_HYPERVISOR_UC (__PAGE_HYPERVISOR_UC | \ _PAGE_GLOBAL | _PAGE_NX) -#endif #endif /* __X86_64_PAGE_H__ */