summaryrefslogtreecommitdiff
path: root/SOURCES/patch-5.17-redhat.patch
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2022-04-26 20:11:32 +0200
committerJan200101 <sentrycraft123@gmail.com>2022-05-29 13:17:03 +0200
commitaae6199a8635fe7a3c27573298ee7ccd16efe27d (patch)
tree2620bb66f60b020a5e412e9ec3f2233ad80446fa /SOURCES/patch-5.17-redhat.patch
parent14ce95931365e3c0a9bd535fdcba2202001c0c37 (diff)
downloadkernel-fsync-aae6199a8635fe7a3c27573298ee7ccd16efe27d.tar.gz
kernel-fsync-aae6199a8635fe7a3c27573298ee7ccd16efe27d.zip
kernel 5.17.4
Diffstat (limited to 'SOURCES/patch-5.17-redhat.patch')
-rw-r--r--SOURCES/patch-5.17-redhat.patch173
1 files changed, 2 insertions, 171 deletions
diff --git a/SOURCES/patch-5.17-redhat.patch b/SOURCES/patch-5.17-redhat.patch
index 81145cc..905be3a 100644
--- a/SOURCES/patch-5.17-redhat.patch
+++ b/SOURCES/patch-5.17-redhat.patch
@@ -43,7 +43,6 @@
include/linux/random.h | 7 ++
include/linux/rmi.h | 1 +
include/linux/security.h | 5 +
- include/sound/memalloc.h | 5 +
init/Kconfig | 2 +-
kernel/dma/swiotlb.c | 12 +-
kernel/module.c | 2 +
@@ -55,8 +54,7 @@
security/lockdown/Kconfig | 13 +++
security/lockdown/lockdown.c | 1 +
security/security.c | 6 +
- sound/core/memalloc.c | 111 +++++++++++++++++-
- 58 files changed, 884 insertions(+), 208 deletions(-)
+ 56 files changed, 769 insertions(+), 207 deletions(-)
diff --git a/Documentation/core-api/dma-attributes.rst b/Documentation/core-api/dma-attributes.rst
index 1887d92e8e92..17706dc91ec9 100644
@@ -108,7 +106,7 @@ index 000000000000..733a26bd887a
+
+endmenu
diff --git a/Makefile b/Makefile
-index 02fbef1a0213..7e08c751f348 100644
+index d7747e4c216e..7a429bc431b4 100644
--- a/Makefile
+++ b/Makefile
@@ -18,6 +18,10 @@ $(if $(filter __%, $(MAKECMDGOALS)), \
@@ -1822,22 +1820,6 @@ index 25b3ef71f495..d37a6c88c69f 100644
#endif /* CONFIG_SECURITY */
#if defined(CONFIG_SECURITY) && defined(CONFIG_WATCH_QUEUE)
-diff --git a/include/sound/memalloc.h b/include/sound/memalloc.h
-index 653dfffb3ac8..8d79cebf95f3 100644
---- a/include/sound/memalloc.h
-+++ b/include/sound/memalloc.h
-@@ -51,6 +51,11 @@ struct snd_dma_device {
- #define SNDRV_DMA_TYPE_DEV_SG SNDRV_DMA_TYPE_DEV /* no SG-buf support */
- #define SNDRV_DMA_TYPE_DEV_WC_SG SNDRV_DMA_TYPE_DEV_WC
- #endif
-+/* fallback types, don't use those directly */
-+#ifdef CONFIG_SND_DMA_SGBUF
-+#define SNDRV_DMA_TYPE_DEV_SG_FALLBACK 10
-+#define SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK 11
-+#endif
-
- /*
- * info for buffer allocation
diff --git a/init/Kconfig b/init/Kconfig
index e9119bf54b1f..e3b57b4898fe 100644
--- a/init/Kconfig
@@ -2053,154 +2035,3 @@ index b7cf5cbfdc67..3cde9062fcf6 100644
#ifdef CONFIG_PERF_EVENTS
int security_perf_event_open(struct perf_event_attr *attr, int type)
{
-diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c
-index 6fd763d4d15b..15dc7160ba34 100644
---- a/sound/core/memalloc.c
-+++ b/sound/core/memalloc.c
-@@ -499,6 +499,10 @@ static const struct snd_malloc_ops snd_dma_wc_ops = {
- };
- #endif /* CONFIG_X86 */
-
-+#ifdef CONFIG_SND_DMA_SGBUF
-+static void *snd_dma_sg_fallback_alloc(struct snd_dma_buffer *dmab, size_t size);
-+#endif
-+
- /*
- * Non-contiguous pages allocator
- */
-@@ -509,8 +513,18 @@ static void *snd_dma_noncontig_alloc(struct snd_dma_buffer *dmab, size_t size)
-
- sgt = dma_alloc_noncontiguous(dmab->dev.dev, size, dmab->dev.dir,
- DEFAULT_GFP, 0);
-- if (!sgt)
-+ if (!sgt) {
-+#ifdef CONFIG_SND_DMA_SGBUF
-+ if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG)
-+ dmab->dev.type = SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK;
-+ else
-+ dmab->dev.type = SNDRV_DMA_TYPE_DEV_SG_FALLBACK;
-+ return snd_dma_sg_fallback_alloc(dmab, size);
-+#else
- return NULL;
-+#endif
-+ }
-+
- dmab->dev.need_sync = dma_need_sync(dmab->dev.dev,
- sg_dma_address(sgt->sgl));
- p = dma_vmap_noncontiguous(dmab->dev.dev, size, sgt);
-@@ -633,6 +647,8 @@ static void *snd_dma_sg_wc_alloc(struct snd_dma_buffer *dmab, size_t size)
-
- if (!p)
- return NULL;
-+ if (dmab->dev.type != SNDRV_DMA_TYPE_DEV_WC_SG)
-+ return p;
- for_each_sgtable_page(sgt, &iter, 0)
- set_memory_wc(sg_wc_address(&iter), 1);
- return p;
-@@ -665,6 +681,95 @@ static const struct snd_malloc_ops snd_dma_sg_wc_ops = {
- .get_page = snd_dma_noncontig_get_page,
- .get_chunk_size = snd_dma_noncontig_get_chunk_size,
- };
-+
-+/* Fallback SG-buffer allocations for x86 */
-+struct snd_dma_sg_fallback {
-+ size_t count;
-+ struct page **pages;
-+ dma_addr_t *addrs;
-+};
-+
-+static void __snd_dma_sg_fallback_free(struct snd_dma_buffer *dmab,
-+ struct snd_dma_sg_fallback *sgbuf)
-+{
-+ size_t i;
-+
-+ if (sgbuf->count && dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK)
-+ set_pages_array_wb(sgbuf->pages, sgbuf->count);
-+ for (i = 0; i < sgbuf->count && sgbuf->pages[i]; i++)
-+ dma_free_coherent(dmab->dev.dev, PAGE_SIZE,
-+ page_address(sgbuf->pages[i]),
-+ sgbuf->addrs[i]);
-+ kvfree(sgbuf->pages);
-+ kvfree(sgbuf->addrs);
-+ kfree(sgbuf);
-+}
-+
-+static void *snd_dma_sg_fallback_alloc(struct snd_dma_buffer *dmab, size_t size)
-+{
-+ struct snd_dma_sg_fallback *sgbuf;
-+ struct page **pages;
-+ size_t i, count;
-+ void *p;
-+
-+ sgbuf = kzalloc(sizeof(*sgbuf), GFP_KERNEL);
-+ if (!sgbuf)
-+ return NULL;
-+ count = PAGE_ALIGN(size) >> PAGE_SHIFT;
-+ pages = kvcalloc(count, sizeof(*pages), GFP_KERNEL);
-+ if (!pages)
-+ goto error;
-+ sgbuf->pages = pages;
-+ sgbuf->addrs = kvcalloc(count, sizeof(*sgbuf->addrs), GFP_KERNEL);
-+ if (!sgbuf->addrs)
-+ goto error;
-+
-+ for (i = 0; i < count; sgbuf->count++, i++) {
-+ p = dma_alloc_coherent(dmab->dev.dev, PAGE_SIZE,
-+ &sgbuf->addrs[i], DEFAULT_GFP);
-+ if (!p)
-+ goto error;
-+ sgbuf->pages[i] = virt_to_page(p);
-+ }
-+
-+ if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK)
-+ set_pages_array_wc(pages, count);
-+ p = vmap(pages, count, VM_MAP, PAGE_KERNEL);
-+ if (!p)
-+ goto error;
-+ dmab->private_data = sgbuf;
-+ return p;
-+
-+ error:
-+ __snd_dma_sg_fallback_free(dmab, sgbuf);
-+ return NULL;
-+}
-+
-+static void snd_dma_sg_fallback_free(struct snd_dma_buffer *dmab)
-+{
-+ vunmap(dmab->area);
-+ __snd_dma_sg_fallback_free(dmab, dmab->private_data);
-+}
-+
-+static int snd_dma_sg_fallback_mmap(struct snd_dma_buffer *dmab,
-+ struct vm_area_struct *area)
-+{
-+ struct snd_dma_sg_fallback *sgbuf = dmab->private_data;
-+
-+ if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK)
-+ area->vm_page_prot = pgprot_writecombine(area->vm_page_prot);
-+ return vm_map_pages(area, sgbuf->pages, sgbuf->count);
-+}
-+
-+static const struct snd_malloc_ops snd_dma_sg_fallback_ops = {
-+ .alloc = snd_dma_sg_fallback_alloc,
-+ .free = snd_dma_sg_fallback_free,
-+ .mmap = snd_dma_sg_fallback_mmap,
-+ /* reuse vmalloc helpers */
-+ .get_addr = snd_dma_vmalloc_get_addr,
-+ .get_page = snd_dma_vmalloc_get_page,
-+ .get_chunk_size = snd_dma_vmalloc_get_chunk_size,
-+};
- #endif /* CONFIG_SND_DMA_SGBUF */
-
- /*
-@@ -736,6 +841,10 @@ static const struct snd_malloc_ops *dma_ops[] = {
- #ifdef CONFIG_GENERIC_ALLOCATOR
- [SNDRV_DMA_TYPE_DEV_IRAM] = &snd_dma_iram_ops,
- #endif /* CONFIG_GENERIC_ALLOCATOR */
-+#ifdef CONFIG_SND_DMA_SGBUF
-+ [SNDRV_DMA_TYPE_DEV_SG_FALLBACK] = &snd_dma_sg_fallback_ops,
-+ [SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK] = &snd_dma_sg_fallback_ops,
-+#endif
- #endif /* CONFIG_HAS_DMA */
- };
-