From nobody Mon Feb 9 08:57:06 2026 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=1618236449; cv=none; d=zohomail.com; s=zohoarc; b=Z5ICsCNHbC1KlRDR+293aIHjroa3YkW/7zwDwiy93Zr0KoQmuwqKTgMmHRXIwnTxijM7Na18xRPrwyrRX7GLI+/5X6Eh0aE76WUJCrjMalERB0lylvEtcz5bpN3aJswvWtUXS+dgHCvGAVFoDv6fucMkLUv/R7RmRY1+kOI0CLs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618236449; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=a9yqIDWLh5sL3LqtehE9yMAlebDtEpvP4PzPBcBcKu8=; b=Vrms+Cw3iuGkji8SND1a9YwJPDCaHl61Z4KfYPVlU4da7OdyREVDu1kbf9woMH+3MCew35KY0rRbdyETXy53pRliFE4CGQ4w/AoqcELjr9J/45PVhWR5kpc0WxY8esOrQlwLem+0wKc3V9G8uwPNfuewgTpIVVeZsAGrzokfICg= 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 1618236449115254.28083912636782; Mon, 12 Apr 2021 07:07:29 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.109173.208356 (Exim 4.92) (envelope-from ) id 1lVxDd-0004hy-Se; Mon, 12 Apr 2021 14:07:13 +0000 Received: by outflank-mailman (output) from mailman id 109173.208356; Mon, 12 Apr 2021 14:07:13 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lVxDd-0004hr-PF; Mon, 12 Apr 2021 14:07:13 +0000 Received: by outflank-mailman (input) for mailman id 109173; Mon, 12 Apr 2021 14:07:13 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lVxDc-0004hl-W8 for xen-devel@lists.xenproject.org; Mon, 12 Apr 2021 14:07:13 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id e4421fbc-ab4a-4cf0-85cd-98c7ae45dba4; Mon, 12 Apr 2021 14:07:12 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 53B18B01E; Mon, 12 Apr 2021 14:07:11 +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: e4421fbc-ab4a-4cf0-85cd-98c7ae45dba4 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=1618236431; 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=a9yqIDWLh5sL3LqtehE9yMAlebDtEpvP4PzPBcBcKu8=; b=gBemrL+XQb9PjafG9Nm2xTEp1U7Txo/JkyIlEp4O5dpko8uD0OYBsuYOUhIrSBJaQee3IA JzRwWFglL54Bz88RFVWnPUUmIPFU7kV9Qp7skw1zn8uFwh4EUzklxXsqV4w9sybHeQCHTs ZcRx3kZKf8C0lG54XssEVqOM7uFj+zQ= Subject: [PATCH v2 03/12] x86/mm: the gva_to_gfn() hook is 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 , Tim Deegan References: <3cf73378-b9d6-0eca-12b6-0f628518bebf@suse.com> Message-ID: Date: Mon, 12 Apr 2021 16:07:10 +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 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" As is the adjacent ga_to_gfn() one as well as paging_gva_to_gfn(). Signed-off-by: Jan Beulich Acked-by: Tim Deegan --- v2: Fix !SHADOW_PAGING && !HVM build. --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -1793,7 +1793,6 @@ void np2m_schedule(int dir) p2m_unlock(p2m); } } -#endif =20 unsigned long paging_gva_to_gfn(struct vcpu *v, unsigned long va, @@ -1844,6 +1843,8 @@ unsigned long paging_gva_to_gfn(struct v return hostmode->gva_to_gfn(v, hostp2m, va, pfec); } =20 +#endif /* CONFIG_HVM */ + /* * If the map is non-NULL, we leave this function having acquired an extra= ref * on mfn_to_page(*mfn). In all cases, *pfec contains appropriate --- a/xen/arch/x86/mm/shadow/multi.c +++ b/xen/arch/x86/mm/shadow/multi.c @@ -3030,6 +3030,7 @@ static bool sh_invlpg(struct vcpu *v, un return true; } =20 +#ifdef CONFIG_HVM =20 static unsigned long sh_gva_to_gfn(struct vcpu *v, struct p2m_domain *p2m, @@ -3063,6 +3064,7 @@ sh_gva_to_gfn(struct vcpu *v, struct p2m return gfn_x(gfn); } =20 +#endif /* CONFIG_HVM */ =20 static inline void sh_update_linear_entries(struct vcpu *v) @@ -4183,7 +4185,9 @@ int sh_audit_l4_table(struct vcpu *v, mf const struct paging_mode sh_paging_mode =3D { .page_fault =3D sh_page_fault, .invlpg =3D sh_invlpg, +#ifdef CONFIG_HVM .gva_to_gfn =3D sh_gva_to_gfn, +#endif .update_cr3 =3D sh_update_cr3, .update_paging_modes =3D shadow_update_paging_modes, .flush_tlb =3D shadow_flush_tlb, --- a/xen/arch/x86/mm/shadow/none.c +++ b/xen/arch/x86/mm/shadow/none.c @@ -43,12 +43,14 @@ static bool _invlpg(struct vcpu *v, unsi return true; } =20 +#ifdef CONFIG_HVM static unsigned long _gva_to_gfn(struct vcpu *v, struct p2m_domain *p2m, unsigned long va, uint32_t *pfec) { ASSERT_UNREACHABLE(); return gfn_x(INVALID_GFN); } +#endif =20 static void _update_cr3(struct vcpu *v, int do_locking, bool noflush) { @@ -63,7 +65,9 @@ static void _update_paging_modes(struct static const struct paging_mode sh_paging_none =3D { .page_fault =3D _page_fault, .invlpg =3D _invlpg, +#ifdef CONFIG_HVM .gva_to_gfn =3D _gva_to_gfn, +#endif .update_cr3 =3D _update_cr3, .update_paging_modes =3D _update_paging_modes, }; --- a/xen/include/asm-x86/paging.h +++ b/xen/include/asm-x86/paging.h @@ -127,6 +127,7 @@ struct paging_mode { struct cpu_user_regs *regs); bool (*invlpg )(struct vcpu *v, unsigned long linear); +#ifdef CONFIG_HVM unsigned long (*gva_to_gfn )(struct vcpu *v, struct p2m_domain *p2m, unsigned long va, @@ -136,6 +137,7 @@ struct paging_mode { unsigned long cr3, paddr_t ga, uint32_t *pfec, unsigned int *page_order); +#endif void (*update_cr3 )(struct vcpu *v, int do_locking, bool noflush); void (*update_paging_modes )(struct vcpu *v); @@ -287,6 +289,8 @@ unsigned long paging_gva_to_gfn(struct v unsigned long va, uint32_t *pfec); =20 +#ifdef CONFIG_HVM + /* Translate a guest address using a particular CR3 value. This is used * to by nested HAP code, to walk the guest-supplied NPT tables as if * they were pagetables. @@ -305,6 +309,8 @@ static inline unsigned long paging_ga_to page_order); } =20 +#endif /* CONFIG_HVM */ + /* Update all the things that are derived from the guest's CR3. * Called when the guest changes CR3; the caller can then use v->arch.cr3 * as the value to load into the host CR3 to schedule this vcpu */