From patchwork Wed Jul 1 10:28:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 11636029 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 52FD113B6 for ; Wed, 1 Jul 2020 10:29:27 +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 35C932067D for ; Wed, 1 Jul 2020 10:29:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 35C932067D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass 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.92) (envelope-from ) id 1jqZyf-00027m-30; Wed, 01 Jul 2020 10:28:29 +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 1jqZyd-00027V-UV for xen-devel@lists.xenproject.org; Wed, 01 Jul 2020 10:28:27 +0000 X-Inumbo-ID: 996d8cb2-bb85-11ea-86e8-12813bfff9fa Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 996d8cb2-bb85-11ea-86e8-12813bfff9fa; Wed, 01 Jul 2020 10:28:27 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 75294AD04; Wed, 1 Jul 2020 10:28:26 +0000 (UTC) Subject: [PATCH v2 7/7] x86: only generate compat headers actually needed From: Jan Beulich To: "xen-devel@lists.xenproject.org" References: Message-ID: <5892f237-cfcf-eb19-058c-bd4f45c7bc97@suse.com> Date: Wed, 1 Jul 2020 12:28:27 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Julien Grall , Wei Liu , Paul Durrant , George Dunlap , Andrew Cooper , Ian Jackson , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" As was already the case for XSM/Flask, avoid generating compat headers when they're not going to be needed. To address resulting build issues - move compat/hvm/dm_op.h inclusion to the only source file needing it, - add a little bit of #ifdef-ary. Signed-off-by: Jan Beulich Reviewed-by: Roger Pau Monné --- Alternatively we could consistently drop conditionals (except for per- arch cases perhaps). --- a/xen/arch/x86/hvm/dm.c +++ b/xen/arch/x86/hvm/dm.c @@ -717,6 +717,8 @@ static int dm_op(const struct dmop_args return rc; } +#include + CHECK_dm_op_create_ioreq_server; CHECK_dm_op_get_ioreq_server_info; CHECK_dm_op_ioreq_server_range; --- a/xen/common/compat/domain.c +++ b/xen/common/compat/domain.c @@ -11,7 +11,6 @@ EMIT_FILE; #include #include #include -#include #define xen_vcpu_set_periodic_timer vcpu_set_periodic_timer CHECK_vcpu_set_periodic_timer; @@ -25,6 +24,10 @@ CHECK_SIZE_(struct, vcpu_info); CHECK_vcpu_register_vcpu_info; #undef xen_vcpu_register_vcpu_info +#ifdef CONFIG_HVM + +#include + #define xen_vcpu_hvm_context vcpu_hvm_context #define xen_vcpu_hvm_x86_32 vcpu_hvm_x86_32 #define xen_vcpu_hvm_x86_64 vcpu_hvm_x86_64 @@ -33,6 +36,8 @@ CHECK_vcpu_hvm_context; #undef xen_vcpu_hvm_x86_32 #undef xen_vcpu_hvm_context +#endif + int compat_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg) { struct domain *d = current->domain; @@ -49,6 +54,7 @@ int compat_vcpu_op(int cmd, unsigned int if ( v->vcpu_info == &dummy_vcpu_info ) return -EINVAL; +#ifdef CONFIG_HVM if ( is_hvm_vcpu(v) ) { struct vcpu_hvm_context ctxt; @@ -61,6 +67,7 @@ int compat_vcpu_op(int cmd, unsigned int domain_unlock(d); } else +#endif { struct compat_vcpu_guest_context *ctxt; --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -3,32 +3,34 @@ ifneq ($(CONFIG_COMPAT),) compat-arch-$(CONFIG_X86) := x86_32 headers-y := \ - compat/argo.h \ - compat/callback.h \ + compat/arch-$(compat-arch-y).h \ compat/elfnote.h \ compat/event_channel.h \ compat/features.h \ - compat/grant_table.h \ - compat/hypfs.h \ - compat/kexec.h \ compat/memory.h \ compat/nmi.h \ compat/physdev.h \ compat/platform.h \ + compat/pmu.h \ compat/sched.h \ - compat/trace.h \ compat/vcpu.h \ compat/version.h \ compat/xen.h \ - compat/xenoprof.h + compat/xlat.h headers-$(CONFIG_X86) += compat/arch-x86/pmu.h headers-$(CONFIG_X86) += compat/arch-x86/xen-mca.h headers-$(CONFIG_X86) += compat/arch-x86/xen.h headers-$(CONFIG_X86) += compat/arch-x86/xen-$(compat-arch-y).h -headers-$(CONFIG_X86) += compat/hvm/dm_op.h -headers-$(CONFIG_X86) += compat/hvm/hvm_op.h -headers-$(CONFIG_X86) += compat/hvm/hvm_vcpu.h -headers-y += compat/arch-$(compat-arch-y).h compat/pmu.h compat/xlat.h +headers-$(CONFIG_ARGO) += compat/argo.h +headers-$(CONFIG_PV) += compat/callback.h +headers-$(CONFIG_GRANT_TABLE) += compat/grant_table.h +headers-$(CONFIG_HVM) += compat/hvm/dm_op.h +headers-$(CONFIG_HVM) += compat/hvm/hvm_op.h +headers-$(CONFIG_HVM) += compat/hvm/hvm_vcpu.h +headers-$(CONFIG_HYPFS) += compat/hypfs.h +headers-$(CONFIG_KEXEC) += compat/kexec.h +headers-$(CONFIG_TRACEBUFFER) += compat/trace.h +headers-$(CONFIG_XENOPROF) += compat/xenoprof.h headers-$(CONFIG_XSM_FLASK) += compat/xsm/flask_op.h cppflags-y := -include public/xen-compat.h -DXEN_GENERATING_COMPAT_HEADERS --- a/xen/include/xen/hypercall.h +++ b/xen/include/xen/hypercall.h @@ -216,8 +216,6 @@ extern long compat_argo_op( unsigned long arg4); #endif -#include - extern int compat_dm_op( domid_t domid,