From nobody Fri Nov 29 23:41:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1620368594; cv=none; d=zohomail.com; s=zohoarc; b=Meq/J3LRkIHR7jPDoHo+95Jh4bq59OfLTMoZOXRFSTPnPOpB7BTY1+iJ0qoTubE/WPvfqAJVFv/sjViSITfajnXx90zlLTzz5YK3uyLdwffuAOIYUgAUm0+VXAuObT9g7IL43kEyPyaMAMCCuXAzCZPnpBnNQDCmxNqulWoDAm0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620368594; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=+rPoFfwrDqquUA3/waQM7VjLnXiWggLIa79HlJ27+SQ=; b=bNg3q6QPxt8pgMXbSfzh5e93TvX2lUSbJyVk9O7REHty33AHaT3rKXJXpyZJ3PLPC2gXJx/E6lqzEwhCX2gNvrE5FVI8qTF9j0ieTgtZvFmYtQPFK27lK5wFaQIshqWALvRkfWhx/zXJtTJD0xx22j+LvPj9w/knnJM/XW46Jz4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine 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 1620368594838555.0310547901029; Thu, 6 May 2021 23:23:14 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.123773.233514 (Exim 4.92) (envelope-from ) id 1letso-0002nF-Ma; Fri, 07 May 2021 06:22:42 +0000 Received: by outflank-mailman (output) from mailman id 123773.233514; Fri, 07 May 2021 06:22:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1letso-0002n8-Ix; Fri, 07 May 2021 06:22:42 +0000 Received: by outflank-mailman (input) for mailman id 123773; Fri, 07 May 2021 06:22: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.92) (envelope-from ) id 1letsn-0002n2-Ay for xen-devel@lists.xenproject.org; Fri, 07 May 2021 06:22:41 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 474f3c92-fadc-4433-a115-e596de231dca; Fri, 07 May 2021 06:22:38 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D129DB136; Fri, 7 May 2021 06:22:37 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 474f3c92-fadc-4433-a115-e596de231dca 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=1620368557; 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; bh=+rPoFfwrDqquUA3/waQM7VjLnXiWggLIa79HlJ27+SQ=; b=KL7/+oMv5M6cLjmvv4B81jM2AmBppywBi/0t51iDq2ME69nr97J82QwFlFhLZhl7Ge6/Oa U6DopaIaae62xtndbi74kTgDtrgeBmQcy6YOIxqcJ7gugF/EoM771CSvEGLalQDREjdYe9 NSS7RfXGRt+Iu1j3ZSx0ZT41jWL1NnA= To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= From: Jan Beulich Subject: [PATCH] x86/shim: fix build when !PV32 Message-ID: <08ea57f0-732e-fe12-409c-5487fb493429@suse.com> Date: Fri, 7 May 2021 08:22:38 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" In this case compat headers don't get generated (and aren't needed). The changes made by 527922008bce ("x86: slim down hypercall handling when !PV32") also weren't quite sufficient for this case. Try to limit #ifdef-ary by introducing two "fallback" #define-s. Fixes: d23d792478db ("x86: avoid building COMPAT code when !HVM && !PV32") Reported-by: Andrew Cooper Signed-off-by: Jan Beulich --- a/xen/arch/x86/pv/shim.c +++ b/xen/arch/x86/pv/shim.c @@ -34,8 +34,6 @@ #include #include =20 -#include - #undef virt_to_mfn #define virt_to_mfn(va) _mfn(__virt_to_mfn(va)) =20 @@ -300,8 +298,10 @@ static void write_start_info(struct doma &si->console.domU.mfn) ) BUG(); =20 +#ifdef CONFIG_PV32 if ( compat ) xlat_start_info(si, XLAT_start_info_console_domU); +#endif =20 unmap_domain_page(si); } @@ -675,6 +675,13 @@ void pv_shim_inject_evtchn(unsigned int } } =20 +#ifdef CONFIG_PV32 +# include +#else +# define compat_gnttab_setup_table gnttab_setup_table +# define compat_handle_okay guest_handle_okay +#endif + static long pv_shim_grant_table_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) uop, unsigned int count) @@ -704,10 +711,13 @@ static long pv_shim_grant_table_op(unsig rc =3D -EFAULT; break; } + +#ifdef CONFIG_PV32 if ( compat ) #define XLAT_gnttab_setup_table_HNDL_frame_list(d, s) XLAT_gnttab_setup_table(&nat, &cmp); #undef XLAT_gnttab_setup_table_HNDL_frame_list +#endif =20 nat.status =3D GNTST_okay; =20 @@ -778,6 +788,7 @@ static long pv_shim_grant_table_op(unsig } =20 ASSERT(grant_frames[i]); +#ifdef CONFIG_PV32 if ( compat ) { compat_pfn_t pfn =3D grant_frames[i]; @@ -789,8 +800,10 @@ static long pv_shim_grant_table_op(unsig break; } } - else if ( __copy_to_guest_offset(nat.frame_list, i, - &grant_frames[i], 1) ) + else +#endif + if ( __copy_to_guest_offset(nat.frame_list, i, + &grant_frames[i], 1) ) { nat.status =3D GNTST_bad_virt_addr; rc =3D -EFAULT; @@ -799,10 +812,12 @@ static long pv_shim_grant_table_op(unsig } spin_unlock(&grant_lock); =20 +#ifdef CONFIG_PV32 if ( compat ) #define XLAT_gnttab_setup_table_HNDL_frame_list(d, s) XLAT_gnttab_setup_table(&cmp, &nat); #undef XLAT_gnttab_setup_table_HNDL_frame_list +#endif =20 if ( unlikely(compat ? __copy_to_guest(uop, &cmp, 1) : __copy_to_guest(uop, &nat, 1)) )