From patchwork Thu May 9 13:42:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 10937171 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AB4A1912 for ; Thu, 9 May 2019 13:43:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9149228B0D for ; Thu, 9 May 2019 13:43:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 855E828B14; Thu, 9 May 2019 13:43:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 20D8328B0D for ; Thu, 9 May 2019 13:43:50 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hOjJV-00063N-Bd; Thu, 09 May 2019 13:42:21 +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 1hOjJU-00063H-GO for xen-devel@lists.xenproject.org; Thu, 09 May 2019 13:42:20 +0000 X-Inumbo-ID: 423b4ce6-7260-11e9-830c-830beb5e8ab4 Received: from prv1-mh.provo.novell.com (unknown [137.65.248.33]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 423b4ce6-7260-11e9-830c-830beb5e8ab4; Thu, 09 May 2019 13:42:17 +0000 (UTC) Received: from INET-PRV1-MTA by prv1-mh.provo.novell.com with Novell_GroupWise; Thu, 09 May 2019 07:42:16 -0600 Message-Id: <5CD42E37020000780022D32F@prv1-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 18.1.0 Date: Thu, 09 May 2019 07:42:15 -0600 From: "Jan Beulich" To: "xen-devel" References: <5CD42DCB020000780022D317@prv1-mh.provo.novell.com> In-Reply-To: <5CD42DCB020000780022D317@prv1-mh.provo.novell.com> Mime-Version: 1.0 Content-Disposition: inline Subject: [Xen-devel] [PATCH v2 1/3] x86/mm: short-circuit HVM-only mode flags when !HVM 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: George Dunlap , Andrew Cooper , Wei Liu , Roger Pau Monne Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP #define-ing them to zero allows better code generation in this case, and paves the way for more DCE, allowing to leave certain functions just declared, but not defined. Signed-off-by: Jan Beulich Reviewed-by: Wei Liu Reviewed-by: George Dunlap --- v2: New. --- a/xen/arch/x86/mm/paging.c +++ b/xen/arch/x86/mm/paging.c @@ -837,7 +837,9 @@ int paging_enable(struct domain *d, u32 switch ( mode & (PG_external | PG_translate | PG_refcounts) ) { case 0: +#if PG_external | PG_translate | PG_refcounts case PG_external | PG_translate | PG_refcounts: +#endif break; default: return -EINVAL; --- a/xen/include/asm-x86/paging.h +++ b/xen/include/asm-x86/paging.h @@ -46,19 +46,29 @@ #define PG_SH_enable 0 #define PG_SH_forced 0 #endif +#ifdef CONFIG_HVM #define PG_HAP_enable (1U << PG_HAP_shift) +#else +#define PG_HAP_enable 0 +#endif /* common paging mode bits */ #define PG_mode_shift 10 +#ifdef CONFIG_HVM /* Refcounts based on shadow tables instead of guest tables */ #define PG_refcounts (XEN_DOMCTL_SHADOW_ENABLE_REFCOUNT << PG_mode_shift) -/* Enable log dirty mode */ -#define PG_log_dirty (XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY << PG_mode_shift) /* Xen does p2m translation, not guest */ #define PG_translate (XEN_DOMCTL_SHADOW_ENABLE_TRANSLATE << PG_mode_shift) /* Xen does not steal address space from the domain for its own booking; * requires VT or similar mechanisms */ #define PG_external (XEN_DOMCTL_SHADOW_ENABLE_EXTERNAL << PG_mode_shift) +#else +#define PG_refcounts 0 +#define PG_translate 0 +#define PG_external 0 +#endif +/* Enable log dirty mode */ +#define PG_log_dirty (XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY << PG_mode_shift) /* All paging modes. */ #define PG_MASK (PG_refcounts | PG_log_dirty | PG_translate | PG_external)