62547e
From 068c531fb968ec04509b85f524d0745e6acf5449 Mon Sep 17 00:00:00 2001
62547e
From: Jon Maloy <jmaloy@redhat.com>
62547e
Date: Mon, 5 Dec 2022 15:32:55 -0500
62547e
Subject: [PATCH 2/5] hw/display/qxl: Document qxl_phys2virt()
62547e
MIME-Version: 1.0
62547e
Content-Type: text/plain; charset=UTF-8
62547e
Content-Transfer-Encoding: 8bit
62547e
62547e
RH-Author: Jon Maloy <jmaloy@redhat.com>
62547e
RH-MergeRequest: 240: hw/display/qxl: Have qxl_log_command Return early if no log_cmd handler
62547e
RH-Bugzilla: 2148545
62547e
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
62547e
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
62547e
RH-Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
62547e
RH-Commit: [2/5] f84c0b379022c527fc2508a242443d86454944c0 (jmaloy/jons-qemu-kvm)
62547e
62547e
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2148545
62547e
CVE: CVE-2022-4144
62547e
Upstream: Merged
62547e
62547e
commit b1901de83a9456cde26fc755f71ca2b7b3ef50fc
62547e
Author: Philippe Mathieu-Daudé <philmd@linaro.org>
62547e
Date:   Mon Nov 28 21:27:38 2022 +0100
62547e
62547e
    hw/display/qxl: Document qxl_phys2virt()
62547e
62547e
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
62547e
    Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
62547e
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
62547e
    Message-Id: <20221128202741.4945-3-philmd@linaro.org>
62547e
62547e
(cherry picked from commit b1901de83a9456cde26fc755f71ca2b7b3ef50fc)
62547e
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
62547e
---
62547e
 hw/display/qxl.h | 19 +++++++++++++++++++
62547e
 1 file changed, 19 insertions(+)
62547e
62547e
diff --git a/hw/display/qxl.h b/hw/display/qxl.h
62547e
index 30d21f4d0b..c938f88a2f 100644
62547e
--- a/hw/display/qxl.h
62547e
+++ b/hw/display/qxl.h
62547e
@@ -147,6 +147,25 @@ OBJECT_DECLARE_SIMPLE_TYPE(PCIQXLDevice, PCI_QXL)
62547e
 #define QXL_DEFAULT_REVISION (QXL_REVISION_STABLE_V12 + 1)
62547e
 
62547e
 /* qxl.c */
62547e
+/**
62547e
+ * qxl_phys2virt: Get a pointer within a PCI VRAM memory region.
62547e
+ *
62547e
+ * @qxl: QXL device
62547e
+ * @phys: physical offset of buffer within the VRAM
62547e
+ * @group_id: memory slot group
62547e
+ *
62547e
+ * Returns a host pointer to a buffer placed at offset @phys within the
62547e
+ * active slot @group_id of the PCI VGA RAM memory region associated with
62547e
+ * the @qxl device. If the slot is inactive, or the offset is out
62547e
+ * of the memory region, returns NULL.
62547e
+ *
62547e
+ * Use with care; by the time this function returns, the returned pointer is
62547e
+ * not protected by RCU anymore.  If the caller is not within an RCU critical
62547e
+ * section and does not hold the iothread lock, it must have other means of
62547e
+ * protecting the pointer, such as a reference to the region that includes
62547e
+ * the incoming ram_addr_t.
62547e
+ *
62547e
+ */
62547e
 void *qxl_phys2virt(PCIQXLDevice *qxl, QXLPHYSICAL phys, int group_id);
62547e
 void qxl_set_guest_bug(PCIQXLDevice *qxl, const char *msg, ...)
62547e
     GCC_FMT_ATTR(2, 3);
62547e
-- 
62547e
2.37.3
62547e