From patchwork Mon Apr 12 14:08:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12198193 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E006AC433B4 for ; Mon, 12 Apr 2021 14:09:01 +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 A3C1B61244 for ; Mon, 12 Apr 2021 14:09:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A3C1B61244 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.109186.208392 (Exim 4.92) (envelope-from ) id 1lVxFF-000549-SH; Mon, 12 Apr 2021 14:08:53 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 109186.208392; Mon, 12 Apr 2021 14:08:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lVxFF-000542-O6; Mon, 12 Apr 2021 14:08:53 +0000 Received: by outflank-mailman (input) for mailman id 109186; Mon, 12 Apr 2021 14:08:52 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lVxFE-00053o-3c for xen-devel@lists.xenproject.org; Mon, 12 Apr 2021 14:08:52 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 92f3fdf1-1e40-446e-91b1-1ade3aaeb44b; Mon, 12 Apr 2021 14:08:51 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B2E06AF9E; Mon, 12 Apr 2021 14:08:50 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 92f3fdf1-1e40-446e-91b1-1ade3aaeb44b X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1618236530; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ABE4LcUgraNA73SdEGSmiIlXjTsOODWeZNKtHKbvRrQ=; b=L8xJm6uUaZxy1T37lApMF5qOjuVBuZs5l5mlBn2rJuuQUZdVS51iuA7Xo7Z6JvtB/ySs5E VSocStusG9ZpClsne2anaEsO5Yrv2Ywen/8sV2N4vz0jFnM7+TJuoemWmdlVN5PUJqbasx JuuCehiyUXn4hF+NssppCfJuP0KWuNg= Subject: [PATCH v2 06/12] x86/p2m: hardware-log-dirty related hooks are HVM-only From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , George Dunlap References: <3cf73378-b9d6-0eca-12b6-0f628518bebf@suse.com> Message-ID: Date: Mon, 12 Apr 2021 16:08:50 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <3cf73378-b9d6-0eca-12b6-0f628518bebf@suse.com> Content-Language: en-US Exclude functions using them from !HVM builds, thus making it possible to exclude the hooks as well. By moving an #endif in p2m.c (instead of introducing yet another one) p2m_{get,set}_ioreq_server() get excluded for !HVM builds as well. Signed-off-by: Jan Beulich Acked-by: Roger Pau Monné --- v2: New. --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -369,8 +369,6 @@ void p2m_memory_type_changed(struct doma p2m_unlock(hostp2m); } -#endif /* CONFIG_HVM */ - int p2m_set_ioreq_server(struct domain *d, unsigned int flags, struct ioreq_server *s) @@ -464,6 +462,8 @@ void p2m_flush_hardware_cached_dirty(str } } +#endif /* CONFIG_HVM */ + /* * Force a synchronous P2M TLB flush if a deferred flush is pending. * --- a/xen/include/asm-x86/p2m.h +++ b/xen/include/asm-x86/p2m.h @@ -261,10 +261,10 @@ struct p2m_domain { bool_t *sve); int (*recalc)(struct p2m_domain *p2m, unsigned long gfn); +#ifdef CONFIG_HVM void (*enable_hardware_log_dirty)(struct p2m_domain *p2m); void (*disable_hardware_log_dirty)(struct p2m_domain *p2m); void (*flush_hardware_cached_dirty)(struct p2m_domain *p2m); -#ifdef CONFIG_HVM void (*change_entry_type_global)(struct p2m_domain *p2m, p2m_type_t ot, p2m_type_t nt); @@ -630,6 +630,9 @@ int guest_physmap_add_page(struct domain /* Set a p2m range as populate-on-demand */ int guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn, unsigned int order); + +#ifdef CONFIG_HVM + /* Enable hardware-assisted log-dirty. */ void p2m_enable_hardware_log_dirty(struct domain *d); @@ -639,6 +642,12 @@ void p2m_disable_hardware_log_dirty(stru /* Flush hardware cached dirty GFNs */ void p2m_flush_hardware_cached_dirty(struct domain *d); +#else + +static inline void p2m_flush_hardware_cached_dirty(struct domain *d) {} + +#endif + /* Change types across all p2m entries in a domain */ void p2m_change_entry_type_global(struct domain *d, p2m_type_t ot, p2m_type_t nt);