From: Christoph Hellwig <hch@infradead.org>
To: "Alex Xu (Hello71)" <alex_y_xu@yahoo.ca>
Cc: Christoph Hellwig <hch@infradead.org>,
iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
regressions@lists.linux.dev
Subject: Re: "dma-mapping: remove CONFIG_DMA_REMAP" causes AMD SME boot fail
Date: Wed, 30 Mar 2022 21:08:43 -0700 [thread overview]
Message-ID: <YkUpSy4snmZ7E5xX@infradead.org> (raw)
In-Reply-To: <1648667469.u35o6clg82.none@localhost>
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!
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@infradead.org>
To: "Alex Xu (Hello71)" <alex_y_xu@yahoo.ca>
Cc: Christoph Hellwig <hch@infradead.org>,
iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
regressions@lists.linux.dev
Subject: Re: "dma-mapping: remove CONFIG_DMA_REMAP" causes AMD SME boot fail
Date: Wed, 30 Mar 2022 21:08:43 -0700 [thread overview]
Message-ID: <YkUpSy4snmZ7E5xX@infradead.org> (raw)
In-Reply-To: <1648667469.u35o6clg82.none@localhost>
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!
next prev parent reply other threads:[~2022-03-31 4:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[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:51 ` Alex Xu (Hello71) via iommu
2022-03-30 17:55 ` Christoph Hellwig
2022-03-30 17:55 ` Christoph Hellwig
2022-03-30 18:01 ` Christoph Hellwig
2022-03-30 18:01 ` Christoph Hellwig
2022-03-30 19:17 ` Alex Xu (Hello71)
2022-03-30 19:17 ` Alex Xu (Hello71) via iommu
2022-03-31 4:08 ` Christoph Hellwig [this message]
2022-03-31 4:08 ` Christoph Hellwig
2022-03-31 6:51 ` Thorsten Leemhuis
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
2022-04-15 17:58 ` Thorsten Leemhuis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YkUpSy4snmZ7E5xX@infradead.org \
--to=hch@infradead.org \
--cc=alex_y_xu@yahoo.ca \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=regressions@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.