From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6FB9F3FE2D; Mon, 1 Apr 2024 15:56:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711986990; cv=none; b=G8otEZNwE83XhjtGOPjxSVPV/UM0osHnBXGghmFObCzo18jTiVgxfMMCs6sJoV8bHLqcecMugWlcbuUMv/rfmMQGXf/6pV9eWIBWpOGuSKPjYbBgWeM35aFdpwF+rdkuor7K+2uDBDpdewOQa5B/M7wqdZxnca+SZeoMKU8RdIk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711986990; c=relaxed/simple; bh=hIZ5eNKRUWBBhc6QPIrBntkYoESkeICnqVal8GxCIls=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G0NnIoKhniqJsK2L4EWBQy7Sl54zUb6ypPJeG3TgQHXI4hWPsrn2n4J4VSVFRQZVZDJVRsdEoc8UQoqa8HpRbOz3uNZGyxgfPrnmg8uBpLzpRpYaGoesT09vHdODx7/s4QR7HvTTemXs+8PI6FMZz3YJLzHpmBZRE8ZG+e2DNaE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=yLFQ/pbp; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="yLFQ/pbp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCDFCC433F1; Mon, 1 Apr 2024 15:56:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1711986990; bh=hIZ5eNKRUWBBhc6QPIrBntkYoESkeICnqVal8GxCIls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yLFQ/pbpsUY8ve2p+DbXacmyswnEjb4V9BbrBQaOkt+bXW3dMYiCtL3pO3x88Er77 3quFsIWH7hMo3dgGnzKmww/9mT/HI4yHhLtdis2NQgPZmZ2gDzglqAeuwTr8VJ7hGE 6stgSTbOXAGV0XlZIMmeUqPtXrza8xsmWSnUsKRw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Diana Craciun , Kevin Tian , Eric Auger , Alex Williamson , Sasha Levin Subject: [PATCH 6.8 150/399] vfio/fsl-mc: Block calling interrupt handler without trigger Date: Mon, 1 Apr 2024 17:41:56 +0200 Message-ID: <20240401152553.666531151@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240401152549.131030308@linuxfoundation.org> References: <20240401152549.131030308@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.8-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alex Williamson [ Upstream commit 7447d911af699a15f8d050dfcb7c680a86f87012 ] The eventfd_ctx trigger pointer of the vfio_fsl_mc_irq object is initially NULL and may become NULL if the user sets the trigger eventfd to -1. The interrupt handler itself is guaranteed that trigger is always valid between request_irq() and free_irq(), but the loopback testing mechanisms to invoke the handler function need to test the trigger. The triggering and setting ioctl paths both make use of igate and are therefore mutually exclusive. The vfio-fsl-mc driver does not make use of irqfds, nor does it support any sort of masking operations, therefore unlike vfio-pci and vfio-platform, the flow can remain essentially unchanged. Cc: Diana Craciun Cc: Fixes: cc0ee20bd969 ("vfio/fsl-mc: trigger an interrupt via eventfd") Reviewed-by: Kevin Tian Reviewed-by: Eric Auger Link: https://lore.kernel.org/r/20240308230557.805580-8-alex.williamson@redhat.com Signed-off-by: Alex Williamson Signed-off-by: Sasha Levin --- drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c b/drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c index d62fbfff20b82..82b2afa9b7e31 100644 --- a/drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c +++ b/drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c @@ -141,13 +141,14 @@ static int vfio_fsl_mc_set_irq_trigger(struct vfio_fsl_mc_device *vdev, irq = &vdev->mc_irqs[index]; if (flags & VFIO_IRQ_SET_DATA_NONE) { - vfio_fsl_mc_irq_handler(hwirq, irq); + if (irq->trigger) + eventfd_signal(irq->trigger); } else if (flags & VFIO_IRQ_SET_DATA_BOOL) { u8 trigger = *(u8 *)data; - if (trigger) - vfio_fsl_mc_irq_handler(hwirq, irq); + if (trigger && irq->trigger) + eventfd_signal(irq->trigger); } return 0; -- 2.43.0