| Subject | Re: [RFC v2 26/32] x86/mm: Move force_dma_unencrypted() to common code | From | Dave Hansen <> | Date | Fri, 7 May 2021 14:54:19 -0700 |
| |
> +++ b/arch/x86/mm/mem_encrypt_common.c ... > +/* Override for DMA direct allocation check - ARCH_HAS_FORCE_DMA_UNENCRYPTED */ > +bool force_dma_unencrypted(struct device *dev) > +{ > + /* > + * For SEV, all DMA must be to unencrypted/shared addresses. > + */ > + if (sev_active()) > + return true; > + > + /* > + * For SME, all DMA must be to unencrypted addresses if the > + * device does not support DMA to addresses that include the > + * encryption mask. > + */ > + if (sme_active()) { > + 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); > + > + if (dma_dev_mask <= dma_enc_mask) > + return true; > + } > + > + return false; > +}
This doesn't seem much like common code to me. It seems like 100% SEV code. Is this really where we want to move it?
|