* [PATCH] x86/p2m: please Clang after making certain parts HVM-only
@ 2021-05-05 7:07 Jan Beulich
2021-05-05 8:01 ` Roger Pau Monné
0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2021-05-05 7:07 UTC (permalink / raw)
To: xen-devel; +Cc: Andrew Cooper, Wei Liu, Roger Pau Monné, George Dunlap
Move a few #ifdef-s, to account for diagnostics like
p2m.c:549:1: error: non-void function does not return a value in all control paths [-Werror,-Wreturn-type]
which appear despite paging_mode_translate() resolving to constant
"false" when !HVM. All of the affected functions are intended to become
fully HVM-only anyway, with their non-translated stub handling split off
elsewhere.
Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Fixes: 8d012d3ddffc ("x86/p2m: {get,set}_entry hooks and p2m-pt.c are HVM-only")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -497,21 +497,23 @@ mfn_t __get_gfn_type_access(struct p2m_d
#ifdef CONFIG_HVM
mfn_t mfn;
gfn_t gfn = _gfn(gfn_l);
-#endif
-
- /* Unshare makes no sense withuot populate. */
- if ( q & P2M_UNSHARE )
- q |= P2M_ALLOC;
if ( !p2m || !paging_mode_translate(p2m->domain) )
{
- /* Not necessarily true, but for non-translated guests, we claim
- * it's the most generic kind of memory */
+#endif
+ /*
+ * Not necessarily true, but for non-translated guests we claim
+ * it's the most generic kind of memory.
+ */
*t = p2m_ram_rw;
return _mfn(gfn_l);
+#ifdef CONFIG_HVM
}
-#ifdef CONFIG_HVM
+ /* Unshare makes no sense without populate. */
+ if ( q & P2M_UNSHARE )
+ q |= P2M_ALLOC;
+
if ( locked )
/* Grab the lock here, don't release until put_gfn */
gfn_lock(p2m, gfn, 0);
@@ -1417,18 +1419,18 @@ int set_identity_p2m_entry(struct domain
mfn_t mfn;
struct p2m_domain *p2m = p2m_get_hostp2m(d);
int ret;
-#endif
if ( !paging_mode_translate(d) )
{
+#endif
if ( !is_iommu_enabled(d) )
return 0;
return iommu_legacy_map(d, _dfn(gfn_l), _mfn(gfn_l),
1ul << PAGE_ORDER_4K,
IOMMUF_readable | IOMMUF_writable);
+#ifdef CONFIG_HVM
}
-#ifdef CONFIG_HVM
gfn_lock(p2m, gfn, 0);
mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, 0, NULL, NULL);
@@ -1464,16 +1466,16 @@ int clear_identity_p2m_entry(struct doma
mfn_t mfn;
struct p2m_domain *p2m = p2m_get_hostp2m(d);
int ret;
-#endif
if ( !paging_mode_translate(d) )
{
+#endif
if ( !is_iommu_enabled(d) )
return 0;
return iommu_legacy_unmap(d, _dfn(gfn_l), 1ul << PAGE_ORDER_4K);
+#ifdef CONFIG_HVM
}
-#ifdef CONFIG_HVM
gfn_lock(p2m, gfn, 0);
mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, 0, NULL, NULL);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] x86/p2m: please Clang after making certain parts HVM-only
2021-05-05 7:07 [PATCH] x86/p2m: please Clang after making certain parts HVM-only Jan Beulich
@ 2021-05-05 8:01 ` Roger Pau Monné
0 siblings, 0 replies; 2+ messages in thread
From: Roger Pau Monné @ 2021-05-05 8:01 UTC (permalink / raw)
To: Jan Beulich; +Cc: xen-devel, Andrew Cooper, Wei Liu, George Dunlap
On Wed, May 05, 2021 at 09:07:30AM +0200, Jan Beulich wrote:
> Move a few #ifdef-s, to account for diagnostics like
>
> p2m.c:549:1: error: non-void function does not return a value in all control paths [-Werror,-Wreturn-type]
There's also __builtin_unreachable, but that would get even messier,
and I'm not sure it's supported by all gcc versions we care about.
> which appear despite paging_mode_translate() resolving to constant
> "false" when !HVM. All of the affected functions are intended to become
> fully HVM-only anyway, with their non-translated stub handling split off
> elsewhere.
>
> Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Fixes: 8d012d3ddffc ("x86/p2m: {get,set}_entry hooks and p2m-pt.c are HVM-only")
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Thanks, Roger.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-05 8:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-05 7:07 [PATCH] x86/p2m: please Clang after making certain parts HVM-only Jan Beulich
2021-05-05 8:01 ` Roger Pau Monné
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).