From patchwork Wed Mar 13 15:16:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= X-Patchwork-Id: 13591523 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 10F42C54E68 for ; Wed, 13 Mar 2024 15:17:14 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.692558.1079829 (Exim 4.92) (envelope-from ) id 1rkQLm-000677-FB; Wed, 13 Mar 2024 15:17:02 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 692558.1079829; Wed, 13 Mar 2024 15:17:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rkQLm-00066z-C1; Wed, 13 Mar 2024 15:17:02 +0000 Received: by outflank-mailman (input) for mailman id 692558; Wed, 13 Mar 2024 15:17:01 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rkQLl-00064u-ES for xen-devel@lists.xenproject.org; Wed, 13 Mar 2024 15:17:01 +0000 Received: from fout3-smtp.messagingengine.com (fout3-smtp.messagingengine.com [103.168.172.146]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id bbe0fe38-e14c-11ee-afdd-a90da7624cb6; Wed, 13 Mar 2024 16:16:59 +0100 (CET) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailfout.nyi.internal (Postfix) with ESMTP id 10DB9138009A; Wed, 13 Mar 2024 11:16:58 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 13 Mar 2024 11:16:58 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 13 Mar 2024 11:16:56 -0400 (EDT) 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: bbe0fe38-e14c-11ee-afdd-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= invisiblethingslab.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1710343018; x=1710429418; bh=pRnc2ONRL/ 09dyz6m9s7vlkjBE0IxmuPAPPs7bOI7J0=; b=MQkO2ZK8/TD2NSfb5m2EqpQM06 FsdmkCKynqUItmdWnUKk9aj2lCd+jfm5tyFVMw119Dxuo+ZB3znWigiZa8PkVGRg HxNH8LIA6yrUEiSlRg8sDHM+xLLqmdeTV61txYxkx6MUlN1/z/wcAHuNKApILYGO ZxehVKCO4EI8p9xqItOC0XBHdh5C/49GzMk2b32uZltRTI2nQckxKRbJujFKir9O uQS+vUjV63RdkqK9/XxN6vyvvtkovjdXsK2nZ/3ysnHADQRZuaQyzp98ZTiEcsR7 UqTfDyK98WcpQf8R/Gs4e7iCx8txoXxSv/DWhFKddTgmmzkL/rh8xmPz2ogA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1710343018; x= 1710429418; bh=pRnc2ONRL/09dyz6m9s7vlkjBE0IxmuPAPPs7bOI7J0=; b=N JPOhODajrRVYHIX4XAvRhvndUabjXWg/OfWz+LMH99uTPd37VOajgv5NIS3jQgln G06p7jvwh+rl/eRW4s0A9tC5ucCJyJIh02DAvFnpLxRZLQ1h6gSW9AfLZYFaVL/y mFIiTvn3D3w2JYT8JJqrF5U1z3lPqQ7nRiWsnpuncYLil8moN4VwyLhQVU6mPGYn cwvRT4rePAxsEoOvaIZQNUPnp8gL7fKqr0/76TX37wVjQ/tzJRQY1cE69Ec1FnnF wBsVRr+Vnp+rKcNaT0KZXXMMuB+HEBvX03BHyPGThd2Evbu9pmohEODYidRGqdvh U+BMvKibR7aXesuhD7QGA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrjeehgdejgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfgggtgfesthekredtredtjeenucfhrhhomhepofgrrhgv khcuofgrrhgtiiihkhhofihskhhiqdfikphrvggtkhhiuceomhgrrhhmrghrvghksehinh hvihhsihgslhgvthhhihhnghhslhgrsgdrtghomheqnecuggftrfgrthhtvghrnhepgfeu udehgfdvfeehhedujeehfeduveeugefhkefhheelgeevudetueeiudfggfffnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhgrrhhmrghrvghk sehinhhvihhsihgslhgvthhhihhnghhslhgrsgdrtghomh X-ME-Proxy: Feedback-ID: i1568416f:Fastmail From: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= To: xen-devel@lists.xenproject.org Cc: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [PATCH v5 2/7] x86/msi: Extend per-domain/device warning mechanism Date: Wed, 13 Mar 2024 16:16:07 +0100 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 The arch_msix struct had a single "warned" field with a domid for which warning was issued. Upcoming patch will need similar mechanism for few more warnings, so change it to save a bit field of issued warnings. Signed-off-by: Marek Marczykowski-Górecki --- Should I add also some helper for the boilerplate the handling requires now? I tried some macro that also sets the bit field, but I couldn't get it working. I guess I could make it working with a bitmask in a single uint8_t - would that be preferred? New in v5 --- xen/arch/x86/include/asm/msi.h | 8 +++++++- xen/arch/x86/msi.c | 9 +++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h index 997ccb87be0c..19b1e6631fdf 100644 --- a/xen/arch/x86/include/asm/msi.h +++ b/xen/arch/x86/include/asm/msi.h @@ -217,7 +217,13 @@ struct arch_msix { int table_idx[MAX_MSIX_TABLE_PAGES]; spinlock_t table_lock; bool host_maskall, guest_maskall; - domid_t warned; + domid_t warned_domid; + union { + uint8_t all; + struct { + bool maskall : 1; + } u; + } warned_kind; }; void early_msi_init(void); diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c index e721aaf5c001..6433df30bd60 100644 --- a/xen/arch/x86/msi.c +++ b/xen/arch/x86/msi.c @@ -364,9 +364,14 @@ static bool msi_set_mask_bit(struct irq_desc *desc, bool host, bool guest) domid_t domid = pdev->domain->domain_id; maskall = true; - if ( pdev->msix->warned != domid ) + if ( pdev->msix->warned_domid != domid ) { - pdev->msix->warned = domid; + pdev->msix->warned_domid = domid; + pdev->msix->warned_kind.all = 0; + } + if ( !pdev->msix->warned_kind.u.maskall ) + { + pdev->msix->warned_kind.u.maskall = true; printk(XENLOG_G_WARNING "cannot mask IRQ %d: masking MSI-X on Dom%d's %pp\n", desc->irq, domid, &pdev->sbdf);