linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* "dma-mapping: remove CONFIG_DMA_REMAP" causes AMD SME boot fail
       [not found] <1648659326.eabkokyuym.none.ref@localhost>
@ 2022-03-30 17:51 ` Alex Xu (Hello71)
  2022-03-30 17:55   ` Christoph Hellwig
                     ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Alex Xu (Hello71) @ 2022-03-30 17:51 UTC (permalink / raw)
  To: Christoph Hellwig, regressions; +Cc: linux-kernel, iommu

Hi,

After a recent kernel update, booting one of my machines causes it to 
hang on a black screen. Pressing Lock keys on the USB keyboard does not 
turn on the indicators, and the machine does not appear on the Ethernet 
network. I don't have a serial port on this machine. I didn't try 
netconsole, but I suspect it won't work.

Setting mem_encrypt=0 seems to resolve the issue. Reverting f5ff79fddf0e 
("dma-mapping: remove CONFIG_DMA_REMAP") also appears to resolve the 
issue.

The machine in question has an AMD Ryzen 5 1600 and ASRock B450 Pro4.

Cheers,
Alex.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: "dma-mapping: remove CONFIG_DMA_REMAP" causes AMD SME boot fail
  2022-03-30 17:51 ` "dma-mapping: remove CONFIG_DMA_REMAP" causes AMD SME boot fail Alex Xu (Hello71)
@ 2022-03-30 17:55   ` Christoph Hellwig
  2022-03-30 18:01   ` Christoph Hellwig
  2022-03-31  6:51   ` Thorsten Leemhuis
  2 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2022-03-30 17:55 UTC (permalink / raw)
  To: Alex Xu (Hello71); +Cc: Christoph Hellwig, regressions, linux-kernel, iommu

On Wed, Mar 30, 2022 at 01:51:07PM -0400, Alex Xu (Hello71) wrote:
> Hi,
> 
> After a recent kernel update, booting one of my machines causes it to 
> hang on a black screen. Pressing Lock keys on the USB keyboard does not 
> turn on the indicators, and the machine does not appear on the Ethernet 
> network. I don't have a serial port on this machine. I didn't try 
> netconsole, but I suspect it won't work.
> 
> Setting mem_encrypt=0 seems to resolve the issue. Reverting f5ff79fddf0e 
> ("dma-mapping: remove CONFIG_DMA_REMAP") also appears to resolve the 
> issue.
> 
> The machine in question has an AMD Ryzen 5 1600 and ASRock B450 Pro4.

This looks like something in the AMD IOMMU code or it's users can't
deal with vmalloc addresses.  I'll start looking for a culprit ASAP.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: "dma-mapping: remove CONFIG_DMA_REMAP" causes AMD SME boot fail
  2022-03-30 17:51 ` "dma-mapping: remove CONFIG_DMA_REMAP" causes AMD SME boot fail Alex Xu (Hello71)
  2022-03-30 17:55   ` Christoph Hellwig
@ 2022-03-30 18:01   ` Christoph Hellwig
  2022-03-30 19:17     ` Alex Xu (Hello71)
  2022-03-31  6:51   ` Thorsten Leemhuis
  2 siblings, 1 reply; 7+ messages in thread
From: Christoph Hellwig @ 2022-03-30 18:01 UTC (permalink / raw)
  To: Alex Xu (Hello71); +Cc: Christoph Hellwig, regressions, linux-kernel, iommu

Can you try this patch, which is a bit of a hack?

diff --git a/arch/x86/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c
index 50d209939c66c..61997c2ee0a17 100644
--- a/arch/x86/mm/mem_encrypt.c
+++ b/arch/x86/mm/mem_encrypt.c
@@ -28,7 +28,8 @@ bool force_dma_unencrypted(struct device *dev)
 	 * device does not support DMA to addresses that include the
 	 * encryption mask.
 	 */
-	if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT)) {
+	if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT) &&
+	    !get_dma_ops(dev)) {
 		u64 dma_enc_mask = DMA_BIT_MASK(__ffs64(sme_me_mask));
 		u64 dma_dev_mask = min_not_zero(dev->coherent_dma_mask,
 						dev->bus_dma_limit);

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: "dma-mapping: remove CONFIG_DMA_REMAP" causes AMD SME boot fail
  2022-03-30 18:01   ` Christoph Hellwig
@ 2022-03-30 19:17     ` Alex Xu (Hello71)
  2022-03-31  4:08       ` Christoph Hellwig
  0 siblings, 1 reply; 7+ messages in thread
From: Alex Xu (Hello71) @ 2022-03-30 19:17 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: iommu, linux-kernel, regressions

Excerpts from Christoph Hellwig's message of March 30, 2022 2:01 pm:
> Can you try this patch, which is a bit of a hack?
> 
> diff --git a/arch/x86/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c
> index 50d209939c66c..61997c2ee0a17 100644
> --- a/arch/x86/mm/mem_encrypt.c
> +++ b/arch/x86/mm/mem_encrypt.c
> @@ -28,7 +28,8 @@ bool force_dma_unencrypted(struct device *dev)
>  	 * device does not support DMA to addresses that include the
>  	 * encryption mask.
>  	 */
> -	if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT)) {
> +	if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT) &&
> +	    !get_dma_ops(dev)) {
>  		u64 dma_enc_mask = DMA_BIT_MASK(__ffs64(sme_me_mask));
>  		u64 dma_dev_mask = min_not_zero(dev->coherent_dma_mask,
>  						dev->bus_dma_limit);
> 

This seems to work for me.

Cheers,
Alex.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: "dma-mapping: remove CONFIG_DMA_REMAP" causes AMD SME boot fail
  2022-03-30 19:17     ` Alex Xu (Hello71)
@ 2022-03-31  4:08       ` Christoph Hellwig
  0 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2022-03-31  4:08 UTC (permalink / raw)
  To: Alex Xu (Hello71); +Cc: Christoph Hellwig, iommu, linux-kernel, regressions

On Wed, Mar 30, 2022 at 03:17:20PM -0400, Alex Xu (Hello71) wrote:
> Excerpts from Christoph Hellwig's message of March 30, 2022 2:01 pm:
> > Can you try this patch, which is a bit of a hack?
> > 
> > diff --git a/arch/x86/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c
> > index 50d209939c66c..61997c2ee0a17 100644
> > --- a/arch/x86/mm/mem_encrypt.c
> > +++ b/arch/x86/mm/mem_encrypt.c
> > @@ -28,7 +28,8 @@ bool force_dma_unencrypted(struct device *dev)
> >  	 * device does not support DMA to addresses that include the
> >  	 * encryption mask.
> >  	 */
> > -	if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT)) {
> > +	if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT) &&
> > +	    !get_dma_ops(dev)) {
> >  		u64 dma_enc_mask = DMA_BIT_MASK(__ffs64(sme_me_mask));
> >  		u64 dma_dev_mask = min_not_zero(dev->coherent_dma_mask,
> >  						dev->bus_dma_limit);
> > 
> 
> This seems to work for me.

Ok, I'll try to come up with a less hacky version and will start a
discussion with the AMD folks that know memory encryption better.
Thanks for the report and testing already!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: "dma-mapping: remove CONFIG_DMA_REMAP" causes AMD SME boot fail
  2022-03-30 17:51 ` "dma-mapping: remove CONFIG_DMA_REMAP" causes AMD SME boot fail Alex Xu (Hello71)
  2022-03-30 17:55   ` Christoph Hellwig
  2022-03-30 18:01   ` Christoph Hellwig
@ 2022-03-31  6:51   ` Thorsten Leemhuis
  2022-04-15 17:58     ` "dma-mapping: remove CONFIG_DMA_REMAP" causes AMD SME boot fail #forregzbot Thorsten Leemhuis
  2 siblings, 1 reply; 7+ messages in thread
From: Thorsten Leemhuis @ 2022-03-31  6:51 UTC (permalink / raw)
  To: regressions; +Cc: linux-kernel, iommu

[TLDR: I'm adding the regression report below to regzbot, the Linux
kernel regression tracking bot; all text you find below is compiled from
a few templates paragraphs you might have encountered already already
from similar mails.]

Hi, this is your Linux kernel regression tracker. Sending this just to
the lists, as it's already handled.

On 30.03.22 19:51, Alex Xu (Hello71) wrote:
> 
> After a recent kernel update, booting one of my machines causes it to 
> hang on a black screen. Pressing Lock keys on the USB keyboard does not 
> turn on the indicators, and the machine does not appear on the Ethernet 
> network. I don't have a serial port on this machine. I didn't try 
> netconsole, but I suspect it won't work.
> 
> Setting mem_encrypt=0 seems to resolve the issue. Reverting f5ff79fddf0e 
> ("dma-mapping: remove CONFIG_DMA_REMAP") also appears to resolve the 
> issue.
> 
> The machine in question has an AMD Ryzen 5 1600 and ASRock B450 Pro4.

To be sure below issue doesn't fall through the cracks unnoticed, I'm
adding it to regzbot, my Linux kernel regression tracking bot:

#regzbot ^introduced f5ff79fddf0e
#regzbot title dma: "dma-mapping: remove CONFIG_DMA_REMAP" causes AMD
SME boot fail
#regzbot ignore-activity

If it turns out this isn't a regression, free free to remove it from the
tracking by sending a reply to this thread containing a paragraph like
"#regzbot invalid: reason why this is invalid" (without the quotes).

Ciao, Thorsten

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: "dma-mapping: remove CONFIG_DMA_REMAP" causes AMD SME boot fail #forregzbot
  2022-03-31  6:51   ` Thorsten Leemhuis
@ 2022-04-15 17:58     ` Thorsten Leemhuis
  0 siblings, 0 replies; 7+ messages in thread
From: Thorsten Leemhuis @ 2022-04-15 17:58 UTC (permalink / raw)
  To: regressions; +Cc: linux-kernel, iommu

TWIMC: this mail is primarily send for documentation purposes and for
regzbot, my Linux kernel regression tracking bot. These mails usually
contain '#forregzbot' in the subject, to make them easy to spot and filter.

#regzbot fixed-by: 4fe87e818ea492ade079cc0

On 31.03.22 08:51, Thorsten Leemhuis wrote:
> [TLDR: I'm adding the regression report below to regzbot, the Linux
> kernel regression tracking bot; all text you find below is compiled from
> a few templates paragraphs you might have encountered already already
> from similar mails.]
> 
> Hi, this is your Linux kernel regression tracker. Sending this just to
> the lists, as it's already handled.
> 
> On 30.03.22 19:51, Alex Xu (Hello71) wrote:
>>
>> After a recent kernel update, booting one of my machines causes it to 
>> hang on a black screen. Pressing Lock keys on the USB keyboard does not 
>> turn on the indicators, and the machine does not appear on the Ethernet 
>> network. I don't have a serial port on this machine. I didn't try 
>> netconsole, but I suspect it won't work.
>>
>> Setting mem_encrypt=0 seems to resolve the issue. Reverting f5ff79fddf0e 
>> ("dma-mapping: remove CONFIG_DMA_REMAP") also appears to resolve the 
>> issue.
>>
>> The machine in question has an AMD Ryzen 5 1600 and ASRock B450 Pro4.
> 
> To be sure below issue doesn't fall through the cracks unnoticed, I'm
> adding it to regzbot, my Linux kernel regression tracking bot:
> 
> #regzbot ^introduced f5ff79fddf0e
> #regzbot title dma: "dma-mapping: remove CONFIG_DMA_REMAP" causes AMD
> SME boot fail
> #regzbot ignore-activity
> 
> If it turns out this isn't a regression, free free to remove it from the
> tracking by sending a reply to this thread containing a paragraph like
> "#regzbot invalid: reason why this is invalid" (without the quotes).
> 
> Ciao, Thorsten

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-04-15 17:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1648659326.eabkokyuym.none.ref@localhost>
2022-03-30 17:51 ` "dma-mapping: remove CONFIG_DMA_REMAP" causes AMD SME boot fail Alex Xu (Hello71)
2022-03-30 17:55   ` Christoph Hellwig
2022-03-30 18:01   ` Christoph Hellwig
2022-03-30 19:17     ` Alex Xu (Hello71)
2022-03-31  4:08       ` Christoph Hellwig
2022-03-31  6:51   ` Thorsten Leemhuis
2022-04-15 17:58     ` "dma-mapping: remove CONFIG_DMA_REMAP" causes AMD SME boot fail #forregzbot Thorsten Leemhuis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).