Re: 82fef0ad811f "x86/mm: unencrypted non-blocking DMA allocations use coherent pools" was Re: next-0519 on thinkpad x60: sound related? window manager crash

From: Alex Xu (Hello71)
Date: Sun Jun 07 2020 - 22:24:08 EST


Excerpts from David Rientjes's message of June 7, 2020 8:57 pm:
> Thanks for trying it out, Alex. Would you mind sending your .config and
> command line? I assume either mem_encrypt=on or
> CONFIG_AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT is enabled.
>
> Could you also give this a try?
>
> diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c
> --- a/kernel/dma/direct.c
> +++ b/kernel/dma/direct.c
> @@ -99,10 +99,11 @@ static inline bool dma_should_alloc_from_pool(struct device *dev, gfp_t gfp,
> static inline bool dma_should_free_from_pool(struct device *dev,
> unsigned long attrs)
> {
> - if (IS_ENABLED(CONFIG_DMA_COHERENT_POOL))
> + if (!IS_ENABLED(CONFIG_DMA_COHERENT_POOL))
> + return false;
> + if (force_dma_unencrypted(dev))
> return true;
> - if ((attrs & DMA_ATTR_NO_KERNEL_MAPPING) &&
> - !force_dma_unencrypted(dev))
> + if (attrs & DMA_ATTR_NO_KERNEL_MAPPING)
> return false;
> if (IS_ENABLED(CONFIG_DMA_DIRECT_REMAP))
> return true;
>

This patch doesn't work for me either. It has since occurred to me that
while I do have CONFIG_AMD_MEM_ENCYRPT=y, I have
CONFIG_AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT=n, because it was broken with
amdgpu (unfortunately a downgrade from radeon in this respect). Tried it
again just now and it looks like it's now able to enable KMS, but all it
displays is serious-looking errors.

Sorry for not mentioning that earlier. I'll send you my .config and
command line off-list.

Thanks,
Alex.