Displaying 20 results from an estimated 27 matches for "nvkm_mm_node".
2017 Jan 30
2
[PATCH] drm/nouveau: gk20a: Turn instmem lock into mutex
...e(&imem->lock, flags);
+ mutex_unlock(&imem->lock);
wmb();
nvkm_ltc_invalidate(ltc);
@@ -306,19 +304,18 @@ gk20a_instobj_dtor_iommu(struct nvkm_memory *memory)
struct gk20a_instmem *imem = node->base.imem;
struct device *dev = imem->base.subdev.device->dev;
struct nvkm_mm_node *r;
- unsigned long flags;
int i;
if (unlikely(list_empty(&node->base.mem.regions)))
goto out;
- spin_lock_irqsave(&imem->lock, flags);
+ mutex_lock(&imem->lock);
/* vaddr has already been recycled */
if (node->base.vaddr)
gk20a_instobj_iommu_recycle_vadd...
2017 Feb 24
1
[PATCH] drm/nouveau: gk20a: Turn instmem lock into mutex
...ck);
>>
>> wmb();
>> nvkm_ltc_invalidate(ltc);
>> @@ -306,19 +304,18 @@ gk20a_instobj_dtor_iommu(struct nvkm_memory *memory)
>> struct gk20a_instmem *imem = node->base.imem;
>> struct device *dev = imem->base.subdev.device->dev;
>> struct nvkm_mm_node *r;
>> - unsigned long flags;
>> int i;
>>
>> if (unlikely(list_empty(&node->base.mem.regions)))
>> goto out;
>>
>> - spin_lock_irqsave(&imem->lock, flags);
>> + mutex_lock(&imem->lock);
>>
>> /* vaddr has alr...
2015 Apr 17
2
[PATCH 3/6] mmu: map small pages into big pages(s) by IOMMU if possible
...> diff --git a/drm/nouveau/include/nvkm/subdev/mmu.h b/drm/nouveau/include/nvkm/subdev/mmu.h
> index 3a5368776c31..3230d31a7971 100644
> --- a/drm/nouveau/include/nvkm/subdev/mmu.h
> +++ b/drm/nouveau/include/nvkm/subdev/mmu.h
> @@ -22,6 +22,8 @@ struct nvkm_vma {
> struct nvkm_mm_node *node;
> u64 offset;
> u32 access;
> + struct list_head bp;
> + bool has_iommu_bp;
Whether a chunk of memory is mapped through the IOMMU can be tested by
checking if the IOMMU bit is set in the address recorded in the PTE.
So has_iommu_bp looks redundant her...
2015 Apr 20
3
[PATCH 3/6] mmu: map small pages into big pages(s) by IOMMU if possible
...A. So when unmapping, you can simply check for each PTE
>> entry whether the IOMMU bit is set, and unmap from the IOMMU space
>> after unmapping from the GPU VA space, in a loop similar to that of
>> nvkm_vm_unmap_at().
>>
>> Then we only need priv. You are keeping the nvkm_mm_node of the IOMMU
>> space into it, and you need it to free the IOMMU VA space. If only we
>> could find another way to store it, we could get rid of the whole
>> structure and associated list_head in nvkm_vma...
>>
>> I need to give it some more thoughts, and we will proba...
2015 Feb 11
0
[PATCH v2 6/6] instmem/gk20a: add IOMMU support
...struct gk20a_instobj_priv {
struct nvkm_mem *mem;
/* Pointed by mem */
struct nvkm_mem _mem;
+};
+
+/*
+ * Used for objects allocated using the DMA API
+ */
+struct gk20a_instobj_dma {
+ struct gk20a_instobj_priv base;
+
void *cpuaddr;
dma_addr_t handle;
struct dma_attrs attrs;
struct nvkm_mm_node r;
};
+/*
+ * Used for objects flattened using the IOMMU API
+ */
+struct gk20a_instobj_iommu {
+ struct gk20a_instobj_priv base;
+
+ /* array of base.mem->size pages */
+ struct page *pages[];
+};
+
struct gk20a_instmem_priv {
struct nvkm_instmem base;
spinlock_t lock;
u64 addr;
+
+ /...
2015 Nov 11
2
[PATCH] instmem/gk20a: use DMA API CPU mapping
...head vaddr_node;
- /* How many clients are using vaddr? */
- u32 use_cpt;
};
#define gk20a_instobj(p) container_of((p), struct gk20a_instobj, memory)
@@ -68,7 +65,6 @@ struct gk20a_instobj {
struct gk20a_instobj_dma {
struct gk20a_instobj base;
- u32 *cpuaddr;
dma_addr_t handle;
struct nvkm_mm_node r;
};
@@ -81,6 +77,11 @@ struct gk20a_instobj_dma {
struct gk20a_instobj_iommu {
struct gk20a_instobj base;
+ /* to link into gk20a_instmem::vaddr_lru */
+ struct list_head vaddr_node;
+ /* how many clients are using vaddr? */
+ u32 use_cpt;
+
/* will point to the higher half of pages */...
2015 Apr 17
4
[PATCH 2/6] instmem/gk20a: refer to IOMMU physical translation bit
...mmu_pgshift;
> + unsigned long iommu_phys_addr_bit;
>
> /* Only used by DMA API */
> struct dma_attrs attrs;
> @@ -169,8 +170,8 @@ gk20a_instobj_dtor_iommu(struct gk20a_instobj_priv *_node)
> r = list_first_entry(&_node->mem->regions, struct nvkm_mm_node,
> rl_entry);
>
> - /* clear bit 34 to unmap pages */
> - r->offset &= ~BIT(34 - priv->iommu_pgshift);
> + /* clear IOMMU translation bit to unmap pages */
> + r->offset &= ~BIT(priv->iommu_phys_addr_bit - pr...
2017 Feb 23
0
[PATCH] drm/nouveau: gk20a: Turn instmem lock into mutex
...ex_unlock(&imem->lock);
>
> wmb();
> nvkm_ltc_invalidate(ltc);
> @@ -306,19 +304,18 @@ gk20a_instobj_dtor_iommu(struct nvkm_memory *memory)
> struct gk20a_instmem *imem = node->base.imem;
> struct device *dev = imem->base.subdev.device->dev;
> struct nvkm_mm_node *r;
> - unsigned long flags;
> int i;
>
> if (unlikely(list_empty(&node->base.mem.regions)))
> goto out;
>
> - spin_lock_irqsave(&imem->lock, flags);
> + mutex_lock(&imem->lock);
>
> /* vaddr has already been recycled */
> if (n...
2015 Nov 11
0
[PATCH] instmem/gk20a: use DMA API CPU mapping
...*/
> - u32 use_cpt;
> };
> #define gk20a_instobj(p) container_of((p), struct gk20a_instobj, memory)
>
> @@ -68,7 +65,6 @@ struct gk20a_instobj {
> struct gk20a_instobj_dma {
> struct gk20a_instobj base;
>
> - u32 *cpuaddr;
> dma_addr_t handle;
> struct nvkm_mm_node r;
> };
> @@ -81,6 +77,11 @@ struct gk20a_instobj_dma {
> struct gk20a_instobj_iommu {
> struct gk20a_instobj base;
>
> + /* to link into gk20a_instmem::vaddr_lru */
> + struct list_head vaddr_node;
> + /* how many clients are using vaddr? */
> + u32 use_cpt;
> +...
2015 Apr 16
15
[PATCH 0/6] map big page by platform IOMMU
Hi,
Generally the the imported buffers which has memory type TTM_PL_TT are
mapped as small pages probably due to lack of big page allocation. But the
platform device which also use memory type TTM_PL_TT, like GK20A, can
*allocate* big page though the IOMMU hardware inside the SoC. This is a try
to map the imported buffers as big pages in GMMU by the platform IOMMU. With
some preparation work to
2015 Feb 17
1
[PATCH v3 4/6] instmem/gk20a: use DMA attributes
...gt;
> +#endif
> +
> #include "priv.h"
>
> struct gk20a_instobj_priv {
> @@ -34,6 +38,7 @@ struct gk20a_instobj_priv {
> struct nvkm_mem _mem;
> void *cpuaddr;
> dma_addr_t handle;
> + struct dma_attrs attrs;
> struct nvkm_mm_node r;
> };
>
> @@ -91,8 +96,8 @@ gk20a_instobj_dtor(struct nvkm_object *object)
> if (unlikely(!node->handle))
> return;
>
> - dma_free_coherent(dev, node->mem->size << PAGE_SHIFT, node->cpuaddr,
> - node-...
2015 Apr 16
2
[PATCH 6/6] mmu: gk20a: implement IOMMU mapping for big pages
...+#ifdef __KERNEL__
> +#include <linux/iommu.h>
> +#include <nouveau_platform.h>
> +#endif
> +
> +#include "gf100.h"
> +
> +struct gk20a_mmu_priv {
> + struct nvkm_mmu base;
> +};
> +
> +struct gk20a_mmu_iommu_mapping {
> + struct nvkm_mm_node *node;
> + u64 iova;
> +};
> +
> +extern const u8 gf100_pte_storage_type_map[256];
> +
> +static void
> +gk20a_vm_map(struct nvkm_vma *vma, struct nvkm_gpuobj *pgt,
> + struct nvkm_mem *mem, u32 pte, u64 list)
> +{
> + u32 target = (vma->ac...
2023 Dec 08
1
[PATCH] drm/nouveau: Fixup gk20a instobj hierarchy
...index 1b811d6972a1..201022ae9214 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c
@@ -49,14 +49,14 @@
#include <subdev/mmu.h>
struct gk20a_instobj {
- struct nvkm_memory memory;
+ struct nvkm_instobj base;
struct nvkm_mm_node *mn;
struct gk20a_instmem *imem;
/* CPU mapping */
u32 *vaddr;
};
-#define gk20a_instobj(p) container_of((p), struct gk20a_instobj, memory)
+#define gk20a_instobj(p) container_of((p), struct gk20a_instobj, base.memory)
/*
* Used for objects allocated using the DMA API
@@ -148,7 +148,7...
2015 Feb 17
8
[PATCH v3 0/6] nouveau/gk20a: RAM device removal & IOMMU support
Thanks Ilia for the v2 review! Here is the v3 of this IOMMU support for GK20A
series.
Changes since v2:
- Cleaner changes for ltc
- Fixed typos in gk20a instmem IOMMU comments
Changes since v1:
- Add missing else condition in ltc
- Remove extra flags that slipped into nouveau_display.c and nv84_fence.c.
Original cover letter:
Patches 1-3 make the presence of a RAM device optional, and remove
2015 Jan 23
0
[PATCH 4/6] instmem/gk20a: use DMA attributes
...include <core/device.h>
+#ifdef __KERNEL__
+#include <linux/dma-attrs.h>
+#endif
+
#include "priv.h"
struct gk20a_instobj_priv {
@@ -34,6 +38,7 @@ struct gk20a_instobj_priv {
struct nvkm_mem _mem;
void *cpuaddr;
dma_addr_t handle;
+ struct dma_attrs attrs;
struct nvkm_mm_node r;
};
@@ -91,8 +96,8 @@ gk20a_instobj_dtor(struct nvkm_object *object)
if (unlikely(!node->handle))
return;
- dma_free_coherent(dev, node->mem->size << PAGE_SHIFT, node->cpuaddr,
- node->handle);
+ dma_free_attrs(dev, node->mem->size << PAGE_SHIFT, nod...
2015 Feb 17
0
[PATCH v3 4/6] instmem/gk20a: use DMA attributes
...include <core/device.h>
+#ifdef __KERNEL__
+#include <linux/dma-attrs.h>
+#endif
+
#include "priv.h"
struct gk20a_instobj_priv {
@@ -34,6 +38,7 @@ struct gk20a_instobj_priv {
struct nvkm_mem _mem;
void *cpuaddr;
dma_addr_t handle;
+ struct dma_attrs attrs;
struct nvkm_mm_node r;
};
@@ -91,8 +96,8 @@ gk20a_instobj_dtor(struct nvkm_object *object)
if (unlikely(!node->handle))
return;
- dma_free_coherent(dev, node->mem->size << PAGE_SHIFT, node->cpuaddr,
- node->handle);
+ dma_free_attrs(dev, node->mem->size << PAGE_SHIFT, nod...
2015 Feb 11
9
[PATCH v2 0/6] nouveau/gk20a: RAM device removal & IOMMU support
Changes since v1:
- Add missing else condition in ltc
- Remove extra flags that slipped into nouveau_display.c and nv84_fence.c.
Original cover letter:
Patches 1-3 make the presence of a RAM device optional, and remove GK20A's dummy
RAM driver we were using so far. On chips using shared memory, such a device
can confuse the driver into moving objects where there is no need to, and can
trick
2015 Jan 23
8
[PATCH 0/6] nouveau/gk20a: RAM device removal & IOMMU support
A series I have waited too long to submit, and the recent refactoring made
me pay the price of my perfectionism, so here are the features that are at least
completed
Patches 1-3 make the presence of a RAM device optional, and remove GK20A's dummy
RAM driver we were using so far. On chips using shared memory, such a device
can confuse the driver into moving objects where there is no need to,
2015 Feb 20
6
[PATCH v4 0/6] nouveau/gk20a: RAM device removal & IOMMU support
Changes since v3:
- Use a single dma_attr for all DMA-API allocations in instmem instead of one
per allocation
- Use device.info.ram_size instead of pfb->ram to check whether VRAM is present
outside of nvkm
Changes since v2:
- Cleaner changes for ltc
- Fixed typos in gk20a instmem IOMMU comments
Changes since v1:
- Add missing else condition in ltc
- Remove extra flags that slipped into
2023 Dec 14
1
[PATCH] drm/nouveau: Fixup gk20a instobj hierarchy
...a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c
> @@ -49,14 +49,14 @@
> #include <subdev/mmu.h>
>
> struct gk20a_instobj {
> - struct nvkm_memory memory;
> + struct nvkm_instobj base;
> struct nvkm_mm_node *mn;
> struct gk20a_instmem *imem;
>
> /* CPU mapping */
> u32 *vaddr;
> };
> -#define gk20a_instobj(p) container_of((p), struct gk20a_instobj, memory)
> +#define gk20a_instobj(p) container_of((p), struct gk20a_instobj, base.memory)
>
> /*
> * Use...