Commit f85c2c79 authored by Vikram Narayanan's avatar Vikram Narayanan
Browse files

lcd/dma: Fix dma alloc

The helper macros phys_to_page doesn't work inside LCD. Fix that by changing
those calls to appropriate LCD helpers.

Signed-off-by: Vikram Narayanan's avatarVikram Narayanan <>
parent dcb04d52
......@@ -17,6 +17,8 @@
#include <asm/x86_init.h>
#include <asm/iommu_table.h>
#include <asm/lcd_domains/liblcd.h>
#include <lcd_config/post_hook.h>
static int forbid_dac __read_mostly;
......@@ -112,10 +114,22 @@ again:
/* fallback */
if (!page)
page = lcd_alloc_pages_node(dev_to_node(dev), flag, get_order(size));
if (!page)
if (!page) {
LIBLCD_ERR("%s, failed to allocate dma buffer",
return NULL;
addr = page_to_phys(page);
addr = __pa(lcd_page_address(page));
if (lcd_syscall_iommu_map_page(__gpa(addr), get_order(size), true))
LIBLCD_ERR("iommu map page for desc->dma failed");
if (addr + size > dma_mask) {
lcd_free_pages(page, get_order(size));
......@@ -128,6 +142,8 @@ again:
memset(lcd_page_address(page), 0, size);
*dma_addr = addr;
LIBLCD_MSG("%s, page %p | dma_addr %lx | page_address %p",
__func__, page, *dma_addr, lcd_page_address(page));
return lcd_page_address(page);
Supports Markdown
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