qxl: prepare memslot code for suspend/resume
authorDave Airlie <airlied@redhat.com>
Thu, 4 Jul 2013 04:57:58 +0000 (14:57 +1000)
committerDave Airlie <airlied@redhat.com>
Fri, 5 Jul 2013 00:44:17 +0000 (10:44 +1000)
this splits out initing the hw memslots from the guest info, and
creates an entrypoint for s/r to use.

Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/qxl/qxl_drv.h
drivers/gpu/drm/qxl/qxl_kms.c

index 6a92925..056330e 100644 (file)
@@ -331,6 +331,8 @@ void qxl_modeset_fini(struct qxl_device *qdev);
 int qxl_bo_init(struct qxl_device *qdev);
 void qxl_bo_fini(struct qxl_device *qdev);
 
+void qxl_reinit_memslots(struct qxl_device *qdev);
+
 struct qxl_ring *qxl_ring_create(struct qxl_ring_header *header,
                                 int element_size,
                                 int n_elements,
index e27ce2a..2c6f921 100644 (file)
@@ -72,21 +72,28 @@ static bool qxl_check_device(struct qxl_device *qdev)
        return true;
 }
 
+static void setup_hw_slot(struct qxl_device *qdev, int slot_index,
+                         struct qxl_memslot *slot)
+{
+       qdev->ram_header->mem_slot.mem_start = slot->start_phys_addr;
+       qdev->ram_header->mem_slot.mem_end = slot->end_phys_addr;
+       qxl_io_memslot_add(qdev, slot_index);
+}
+
 static uint8_t setup_slot(struct qxl_device *qdev, uint8_t slot_index_offset,
        unsigned long start_phys_addr, unsigned long end_phys_addr)
 {
        uint64_t high_bits;
        struct qxl_memslot *slot;
        uint8_t slot_index;
-       struct qxl_ram_header *ram_header = qdev->ram_header;
 
        slot_index = qdev->rom->slots_start + slot_index_offset;
        slot = &qdev->mem_slots[slot_index];
        slot->start_phys_addr = start_phys_addr;
        slot->end_phys_addr = end_phys_addr;
-       ram_header->mem_slot.mem_start = slot->start_phys_addr;
-       ram_header->mem_slot.mem_end = slot->end_phys_addr;
-       qxl_io_memslot_add(qdev, slot_index);
+
+       setup_hw_slot(qdev, slot_index, slot);
+
        slot->generation = qdev->rom->slot_generation;
        high_bits = slot_index << qdev->slot_gen_bits;
        high_bits |= slot->generation;
@@ -95,6 +102,12 @@ static uint8_t setup_slot(struct qxl_device *qdev, uint8_t slot_index_offset,
        return slot_index;
 }
 
+void qxl_reinit_memslots(struct qxl_device *qdev)
+{
+       setup_hw_slot(qdev, qdev->main_mem_slot, &qdev->mem_slots[qdev->main_mem_slot]);
+       setup_hw_slot(qdev, qdev->surfaces_mem_slot, &qdev->mem_slots[qdev->surfaces_mem_slot]);
+}
+
 static void qxl_gc_work(struct work_struct *work)
 {
        struct qxl_device *qdev = container_of(work, struct qxl_device, gc_work);