Commit c9fdda2a authored by Dave Airlie's avatar Dave Airlie

qxl: prepare memslot code for suspend/resume

this splits out initing the hw memslots from the guest info, and
creates an entrypoint for s/r to use.
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 2bd6ce84
...@@ -331,6 +331,8 @@ void qxl_modeset_fini(struct qxl_device *qdev); ...@@ -331,6 +331,8 @@ void qxl_modeset_fini(struct qxl_device *qdev);
int qxl_bo_init(struct qxl_device *qdev); int qxl_bo_init(struct qxl_device *qdev);
void qxl_bo_fini(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, struct qxl_ring *qxl_ring_create(struct qxl_ring_header *header,
int element_size, int element_size,
int n_elements, int n_elements,
......
...@@ -72,21 +72,28 @@ static bool qxl_check_device(struct qxl_device *qdev) ...@@ -72,21 +72,28 @@ static bool qxl_check_device(struct qxl_device *qdev)
return true; 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, static uint8_t setup_slot(struct qxl_device *qdev, uint8_t slot_index_offset,
unsigned long start_phys_addr, unsigned long end_phys_addr) unsigned long start_phys_addr, unsigned long end_phys_addr)
{ {
uint64_t high_bits; uint64_t high_bits;
struct qxl_memslot *slot; struct qxl_memslot *slot;
uint8_t slot_index; uint8_t slot_index;
struct qxl_ram_header *ram_header = qdev->ram_header;
slot_index = qdev->rom->slots_start + slot_index_offset; slot_index = qdev->rom->slots_start + slot_index_offset;
slot = &qdev->mem_slots[slot_index]; slot = &qdev->mem_slots[slot_index];
slot->start_phys_addr = start_phys_addr; slot->start_phys_addr = start_phys_addr;
slot->end_phys_addr = end_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; setup_hw_slot(qdev, slot_index, slot);
qxl_io_memslot_add(qdev, slot_index);
slot->generation = qdev->rom->slot_generation; slot->generation = qdev->rom->slot_generation;
high_bits = slot_index << qdev->slot_gen_bits; high_bits = slot_index << qdev->slot_gen_bits;
high_bits |= slot->generation; high_bits |= slot->generation;
...@@ -95,6 +102,12 @@ static uint8_t setup_slot(struct qxl_device *qdev, uint8_t slot_index_offset, ...@@ -95,6 +102,12 @@ static uint8_t setup_slot(struct qxl_device *qdev, uint8_t slot_index_offset,
return slot_index; 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) static void qxl_gc_work(struct work_struct *work)
{ {
struct qxl_device *qdev = container_of(work, struct qxl_device, gc_work); struct qxl_device *qdev = container_of(work, struct qxl_device, gc_work);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment