[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] IOMMU/x86: work around bogus gcc12 warning in hvm_gsi_eoi()


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 27 May 2022 12:37:19 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8+5igBLA9ZoMo2HNVasHs47ydOx4rNXZyhVpZWkZAM4=; b=HmjESJPIIvf+lPw7Wuy0f8BjEfPBs1f/vDKtB5sMIITheQAap8t6n1n4p9jLmN05M06RS7yXL0Sm/6nRVYbLei38Nl1TaKLIpLIwijYjsIzROyERr2ddazNQfWwNYvi7kThR04/gi0+8mSz7INgc80nAs0fn1ZHPKPBVEMVbnYVZTNf3wBV5bv3Pk+s4J0yOyNwyKTDK13m5nScTiBUBJNnY18ajkWOf/iuZ4tt6D1eCasvKN4Qn+3lXqsSYT1iTpIx+Qlnr4a1tqmnHJyMDk9ikRyYz+a4NIgE85Fry8WYZjsj21raZTk14MEe2FGabSfwIND9pO6wZ6Zs0wLOyGg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=na8FeBdEJWBJhR5bfiTxgFfGrmLoMD2fsJMFuTtPKn7S+vG9FlOfeLU6Q6QLFZfWHb9O0daiftmBYc+rBdoF5fmVHovpoJOoCRGU9KI/he4CyuXXKvbswEccgvdGvJY6EO5F2JTC4sPv/+XnBYYMJs8BB8kmintYm7CaLujlhXN/3mT/8uRHQB64uTKkqiODDqreWT3dIhAU3u6HYn0looQ/umyvDDOdjmkM8JAPevAIagD8d+nge55pneHIzKDW9Wcc7hppp6AbkiGfh37gY5unz6hl6S0bMF7Dk9U7zzoFKIOphpqdiptpVgKtCqRwInmbG6yEzrcyQ58/iRv1hw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Paul Durrant <paul@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Fri, 27 May 2022 10:37:33 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

As per [1] the expansion of the pirq_dpci() macro causes a -Waddress
controlled warning (enabled implicitly in our builds, if not by default)
tying the middle part of the involved conditional expression to the
surrounding boolean context. Work around this by introducing a local
inline function in the affected source file.

Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102967
---
This is intended to replace an earlier patch by Andrew [2], open-coding
and then simplifying the macro in the one problematic place.

Note that, with pirq_dpci() presently used solely in the one file being
changed here, we could in principle also remove the #define and use just
an inline(?) function in this file. But then the macro would need
reinstating as soon as a use elsewhere would become necessary.

As to the inline - I think it's warranted here, but it goes against our
general policy of using inline only in header files. Hence I'd be okay
to drop it to avoid controversy.

[2] https://lists.xen.org/archives/html/xen-devel/2021-10/msg01635.html

--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -25,6 +25,18 @@
 #include <asm/hvm/support.h>
 #include <asm/io_apic.h>
 
+/*
+ * Gcc12 takes issue with pirq_dpci() being used in boolean context (see gcc
+ * bug 102967). While we can't replace the macro definition in the header by an
+ * inline function, we can do so here.
+ */
+static inline struct hvm_pirq_dpci *_pirq_dpci(struct pirq *pirq)
+{
+    return pirq_dpci(pirq);
+}
+#undef pirq_dpci
+#define pirq_dpci(pirq) _pirq_dpci(pirq)
+
 static DEFINE_PER_CPU(struct list_head, dpci_list);
 
 /*




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.