Commit b83cc378 authored by Alan Cox's avatar Alan Cox Committed by Greg Kroah-Hartman

atomisp: clean up the hmm init/cleanup indirections

We don't need any of these indirections as we only support one MMU type. Start
by getting rid of the init/clear/free ones. The init ordering check we already
pushed down in a previous patch.

The allocation side is more complicated so leave it for now.
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ec58cbed
...@@ -1454,7 +1454,7 @@ static int atomisp_pci_probe(struct pci_dev *dev, ...@@ -1454,7 +1454,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,
} }
/* Init ISP memory management */ /* Init ISP memory management */
hrt_isp_css_mm_init(); hmm_init();
err = devm_request_threaded_irq(&dev->dev, dev->irq, err = devm_request_threaded_irq(&dev->dev, dev->irq,
atomisp_isr, atomisp_isr_thread, atomisp_isr, atomisp_isr_thread,
...@@ -1486,7 +1486,7 @@ static int atomisp_pci_probe(struct pci_dev *dev, ...@@ -1486,7 +1486,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,
css_init_fail: css_init_fail:
devm_free_irq(&dev->dev, dev->irq, isp); devm_free_irq(&dev->dev, dev->irq, isp);
request_irq_fail: request_irq_fail:
hrt_isp_css_mm_clear(); hmm_cleanup();
hmm_pool_unregister(HMM_POOL_TYPE_RESERVED); hmm_pool_unregister(HMM_POOL_TYPE_RESERVED);
hmm_pool_fail: hmm_pool_fail:
destroy_workqueue(isp->wdt_work_queue); destroy_workqueue(isp->wdt_work_queue);
...@@ -1538,7 +1538,7 @@ static void atomisp_pci_remove(struct pci_dev *dev) ...@@ -1538,7 +1538,7 @@ static void atomisp_pci_remove(struct pci_dev *dev)
atomisp_acc_cleanup(isp); atomisp_acc_cleanup(isp);
atomisp_css_unload_firmware(isp); atomisp_css_unload_firmware(isp);
hrt_isp_css_mm_clear(); hmm_cleanup();
pm_runtime_forbid(&dev->dev); pm_runtime_forbid(&dev->dev);
pm_runtime_get_noresume(&dev->dev); pm_runtime_get_noresume(&dev->dev);
......
...@@ -55,7 +55,7 @@ mmgr_calloc(const size_t N, const size_t size) ...@@ -55,7 +55,7 @@ mmgr_calloc(const size_t N, const size_t size)
void void
mmgr_free(hrt_vaddress vaddr) mmgr_free(hrt_vaddress vaddr)
{ {
hrt_isp_css_mm_free(vaddr); hmm_free(vaddr);
} }
void void
......
...@@ -272,6 +272,8 @@ void hmm_free(ia_css_ptr virt) ...@@ -272,6 +272,8 @@ void hmm_free(ia_css_ptr virt)
{ {
struct hmm_buffer_object *bo; struct hmm_buffer_object *bo;
WARN_ON(!virt);
bo = hmm_bo_device_search_start(&bo_device, (unsigned int)virt); bo = hmm_bo_device_search_start(&bo_device, (unsigned int)virt);
if (!bo) { if (!bo) {
...@@ -284,9 +286,7 @@ void hmm_free(ia_css_ptr virt) ...@@ -284,9 +286,7 @@ void hmm_free(ia_css_ptr virt)
hmm_mem_stat.tol_cnt -= bo->pgnr; hmm_mem_stat.tol_cnt -= bo->pgnr;
hmm_bo_unbind(bo); hmm_bo_unbind(bo);
hmm_bo_free_pages(bo); hmm_bo_free_pages(bo);
hmm_bo_unref(bo); hmm_bo_unref(bo);
} }
......
...@@ -28,13 +28,6 @@ ...@@ -28,13 +28,6 @@
#define __page_align(size) (((size) + (PAGE_SIZE-1)) & (~(PAGE_SIZE-1))) #define __page_align(size) (((size) + (PAGE_SIZE-1)) & (~(PAGE_SIZE-1)))
static unsigned init_done;
void hrt_isp_css_mm_init(void)
{
hmm_init();
init_done = 1;
}
int hrt_isp_css_mm_set(ia_css_ptr virt_addr, int c, size_t bytes) int hrt_isp_css_mm_set(ia_css_ptr virt_addr, int c, size_t bytes)
{ {
if (virt_addr) if (virt_addr)
...@@ -57,20 +50,6 @@ int hrt_isp_css_mm_store(ia_css_ptr virt_addr, const void *data, size_t bytes) ...@@ -57,20 +50,6 @@ int hrt_isp_css_mm_store(ia_css_ptr virt_addr, const void *data, size_t bytes)
return -EFAULT; return -EFAULT;
} }
void hrt_isp_css_mm_free(ia_css_ptr virt_addr)
{
if (virt_addr)
hmm_free(virt_addr);
}
void hrt_isp_css_mm_clear(void)
{
if (init_done) {
hmm_cleanup();
init_done = 0;
}
}
static void *my_userptr; static void *my_userptr;
static unsigned my_num_pages; static unsigned my_num_pages;
static enum hrt_userptr_type my_usr_type; static enum hrt_userptr_type my_usr_type;
...@@ -89,8 +68,6 @@ static ia_css_ptr __hrt_isp_css_mm_alloc(size_t bytes, void *userptr, ...@@ -89,8 +68,6 @@ static ia_css_ptr __hrt_isp_css_mm_alloc(size_t bytes, void *userptr,
enum hrt_userptr_type type, enum hrt_userptr_type type,
bool cached) bool cached)
{ {
if (!init_done)
hrt_isp_css_mm_init();
#ifdef CONFIG_ION #ifdef CONFIG_ION
if (type == HRT_USR_ION) if (type == HRT_USR_ION)
return hmm_alloc(bytes, HMM_BO_ION, 0, return hmm_alloc(bytes, HMM_BO_ION, 0,
...@@ -138,9 +115,6 @@ ia_css_ptr hrt_isp_css_mm_alloc_user_ptr(size_t bytes, void *userptr, ...@@ -138,9 +115,6 @@ ia_css_ptr hrt_isp_css_mm_alloc_user_ptr(size_t bytes, void *userptr,
ia_css_ptr hrt_isp_css_mm_alloc_cached(size_t bytes) ia_css_ptr hrt_isp_css_mm_alloc_cached(size_t bytes)
{ {
if (!init_done)
hrt_isp_css_mm_init();
if (my_userptr == NULL) if (my_userptr == NULL)
return hmm_alloc(bytes, HMM_BO_PRIVATE, 0, 0, return hmm_alloc(bytes, HMM_BO_PRIVATE, 0, 0,
HMM_CACHED); HMM_CACHED);
......
...@@ -41,7 +41,6 @@ struct hrt_userbuffer_attr { ...@@ -41,7 +41,6 @@ struct hrt_userbuffer_attr {
unsigned int pgnr; unsigned int pgnr;
}; };
void hrt_isp_css_mm_init(void);
void hrt_isp_css_mm_set_user_ptr(void *userptr, void hrt_isp_css_mm_set_user_ptr(void *userptr,
unsigned int num_pages, enum hrt_userptr_type); unsigned int num_pages, enum hrt_userptr_type);
...@@ -60,9 +59,6 @@ ia_css_ptr hrt_isp_css_mm_alloc_cached(size_t bytes); ...@@ -60,9 +59,6 @@ ia_css_ptr hrt_isp_css_mm_alloc_cached(size_t bytes);
ia_css_ptr hrt_isp_css_mm_calloc(size_t bytes); ia_css_ptr hrt_isp_css_mm_calloc(size_t bytes);
ia_css_ptr hrt_isp_css_mm_calloc_cached(size_t bytes); ia_css_ptr hrt_isp_css_mm_calloc_cached(size_t bytes);
/* Free memory, given a virtual address */
void hrt_isp_css_mm_free(ia_css_ptr virt_addr);
/* Store data to a virtual address */ /* Store data to a virtual address */
int hrt_isp_css_mm_load(ia_css_ptr virt_addr, void *data, size_t bytes); int hrt_isp_css_mm_load(ia_css_ptr virt_addr, void *data, size_t bytes);
...@@ -81,5 +77,4 @@ int hrt_isp_css_mm_store_int(ia_css_ptr virt_addr, int data); ...@@ -81,5 +77,4 @@ int hrt_isp_css_mm_store_int(ia_css_ptr virt_addr, int data);
the display driver on the FPGA system */ the display driver on the FPGA system */
phys_addr_t hrt_isp_css_virt_to_phys(ia_css_ptr virt_addr); phys_addr_t hrt_isp_css_virt_to_phys(ia_css_ptr virt_addr);
void hrt_isp_css_mm_clear(void);
#endif /* _hive_isp_css_mm_hrt_h_ */ #endif /* _hive_isp_css_mm_hrt_h_ */
...@@ -47,9 +47,9 @@ ia_css_ptr mmgr_calloc(const size_t N, const size_t size) ...@@ -47,9 +47,9 @@ ia_css_ptr mmgr_calloc(const size_t N, const size_t size)
void mmgr_free(ia_css_ptr vaddr) void mmgr_free(ia_css_ptr vaddr)
{ {
/* "free()" should accept NULL, "hrt_isp_css_mm_free()" may not */ /* "free()" should accept NULL, "hmm_free()" may not */
if (vaddr) if (vaddr)
hrt_isp_css_mm_free(vaddr); hmm_free(vaddr);
} }
ia_css_ptr mmgr_alloc_attr(const size_t size, const uint16_t attribute) ia_css_ptr mmgr_alloc_attr(const size_t size, const uint16_t attribute)
......
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