From patchwork Fri Apr 26 17:53:59 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: 13645225 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 81EACC25B5F for ; Fri, 26 Apr 2024 17:55:39 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.712995.1113935 (Exim 4.92) (envelope-from ) id 1s0Pn4-00050Q-9S; Fri, 26 Apr 2024 17:55:18 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 712995.1113935; Fri, 26 Apr 2024 17:55:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s0Pn4-00050J-6L; Fri, 26 Apr 2024 17:55:18 +0000 Received: by outflank-mailman (input) for mailman id 712995; Fri, 26 Apr 2024 17:55:17 +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 1s0Pn3-0004Xj-1L for xen-devel@lists.xenproject.org; Fri, 26 Apr 2024 17:55:17 +0000 Received: from wfhigh5-smtp.messagingengine.com (wfhigh5-smtp.messagingengine.com [64.147.123.156]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 22cd8763-03f6-11ef-909a-e314d9c70b13; Fri, 26 Apr 2024 19:55:16 +0200 (CEST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfhigh.west.internal (Postfix) with ESMTP id 6107A1800120; Fri, 26 Apr 2024 13:55:14 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Fri, 26 Apr 2024 13:55:14 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 26 Apr 2024 13:55:12 -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: 22cd8763-03f6-11ef-909a-e314d9c70b13 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=fm3; t=1714154113; x=1714240513; bh=honjTb6abt tQjuzNiX/lJMZfyWZ6V6USbB6qxEtNQxA=; b=ji60msnEKEfXtuFeFuu4U4C+4j HTwVTgFU+Afx133SGtZNHGazKsnVf0u1AUR3w1B+of3PJEN9eGdmXPLc/zbqsqGv gCvY7fjSoMyLZq1i7PDW+9N000KRW++R/m3c2AP1bGnHTGXhXl7SqxpBgzTFXe/+ hUA2qiYGBOBU8bgJLM1q0Uk/jiEwoIUS0x+mABxmemxjcnQZ+lmTiA6woFBuWzLL 83qlcFcP3f69mk3ljYtnZvi7wrXDsgj5HeexfHuGUkoPmJWGMchdHZe4GnMTy94I v0t0f4OJfEzvbJr7K93lnmCE04G6KTr5CpHXcGBir1YWX6VtBaiVnOmUcwRA== 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=fm3; t=1714154113; x= 1714240513; bh=honjTb6abttQjuzNiX/lJMZfyWZ6V6USbB6qxEtNQxA=; b=B xO8B9qNEStbq4S0dLaDT7ls3zo5cUAFKYLDrfzK5G0gOcDgBwn8fVgB2aRkbIhCT HGHifMGjoKa5wjIGT56Oq5384+rFDfkALqGGdFJaVjM2O4qreyrZRWBa7nCsOwNp v8oF/36mJ1XprsUWxg0/QDDiY64TBqhGVJfPaT/GJhFRnqLTB77pPgMK41+ocI7N VmmjMx/tLYfdSIMFXi/zX+78ayIveTgk4J59vdda9IlXlD27vUgsdnf7BPiabC5h UkSvle246P+4caaIRczwohFcrHG7RZO5XrCvTN840xY0mm+bV7GVkp8dsKoiuYjk xzu5CJju+wyufBksSMzCw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudelledguddulecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvfevufffkffojghfgggtgfesthekredtredtjeenucfhrhhomhepofgr rhgvkhcuofgrrhgtiiihkhhofihskhhiqdfikphrvggtkhhiuceomhgrrhhmrghrvghkse hinhhvihhsihgslhgvthhhihhnghhslhgrsgdrtghomheqnecuggftrfgrthhtvghrnhep gfeuudehgfdvfeehhedujeehfeduveeugefhkefhheelgeevudetueeiudfggfffnecuve hluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhgrrhhmrghr vghksehinhhvihhsihgslhgvthhhihhnghhslhgrsgdrtghomh 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?= Subject: [PATCH v6 2/7] x86/msi: Extend per-domain/device warning mechanism Date: Fri, 26 Apr 2024 19:53:59 +0200 Message-ID: <46f33e8ae1aa7d310e7a99e9da29d29096b0935b.1714154036.git-series.marmarek@invisiblethingslab.com> X-Mailer: git-send-email 2.44.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 Reviewed-by: Jan Beulich --- Changes in v6: - add MSIX_CHECK_WARN macro (Jan) - drop struct name from warned_kind union (Jan) New in v5 --- xen/arch/x86/include/asm/msi.h | 17 ++++++++++++++++- xen/arch/x86/msi.c | 5 +---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h index 997ccb87be0c..bcfdfd35345d 100644 --- a/xen/arch/x86/include/asm/msi.h +++ b/xen/arch/x86/include/asm/msi.h @@ -208,6 +208,15 @@ struct msg_address { PCI_MSIX_ENTRY_SIZE + \ (~PCI_MSIX_BIRMASK & (PAGE_SIZE - 1))) +#define MSIX_CHECK_WARN(msix, domid, which) ({ \ + if ( (msix)->warned_domid != (domid) ) \ + { \ + (msix)->warned_domid = (domid); \ + (msix)->warned_kind.all = 0; \ + } \ + (msix)->warned_kind.which ? false : ((msix)->warned_kind.which = true); \ +}) + struct arch_msix { unsigned int nr_entries, used_entries; struct { @@ -217,7 +226,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; + }; + } warned_kind; }; void early_msi_init(void); diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c index e721aaf5c001..42c793426da3 100644 --- a/xen/arch/x86/msi.c +++ b/xen/arch/x86/msi.c @@ -364,13 +364,10 @@ 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 ) - { - pdev->msix->warned = domid; + if ( MSIX_CHECK_WARN(pdev->msix, domid, maskall) ) printk(XENLOG_G_WARNING "cannot mask IRQ %d: masking MSI-X on Dom%d's %pp\n", desc->irq, domid, &pdev->sbdf); - } } pdev->msix->host_maskall = maskall; if ( maskall || pdev->msix->guest_maskall )