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