1
0
Fork 0
alistair23-linux/drivers/net/ethernet/amazon/ena
Shay Agroskin a447dbb44d net: ena: set initial DMA width to avoid intel iommu issue
[ Upstream commit 09323b3bca ]

The ENA driver uses the readless mechanism, which uses DMA, to find
out what the DMA mask is supposed to be.

If DMA is used without setting the dma_mask first, it causes the
Intel IOMMU driver to think that ENA is a 32-bit device and therefore
disables IOMMU passthrough permanently.

This patch sets the dma_mask to be ENA_MAX_PHYS_ADDR_SIZE_BITS=48
before readless initialization in
ena_device_init()->ena_com_mmio_reg_read_request_init(),
which is large enough to workaround the intel_iommu issue.

DMA mask is set again to the correct value after it's received from the
device after readless is initialized.

The patch also changes the driver to use dma_set_mask_and_coherent()
function instead of the two pci_set_dma_mask() and
pci_set_consistent_dma_mask() ones. Both methods achieve the same
effect.

Fixes: 1738cd3ed3 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)")
Signed-off-by: Mike Cui <mikecui@amazon.com>
Signed-off-by: Arthur Kiyanovski <akiyano@amazon.com>
Signed-off-by: Shay Agroskin <shayagr@amazon.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-12-02 08:49:52 +01:00
..
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
ena_admin_defs.h net: ena: enable the interrupt_moderation in driver_supported_features 2019-09-16 22:06:02 +02:00
ena_com.c net: ena: fix error returning in ena_com_get_hash_function() 2020-06-22 09:30:51 +02:00
ena_com.h net: ena: make ena rxfh support ETH_RSS_HASH_NO_CHANGE 2020-03-05 16:43:47 +01:00
ena_common_defs.h net: ena: complete host info to match latest ENA spec 2018-10-11 10:13:50 -07:00
ena_eth_com.c net: ena: clean up indentation issue 2019-09-27 20:32:02 +02:00
ena_eth_com.h net: ena: optimise calculations for CQ doorbell 2019-06-03 13:30:38 -07:00
ena_eth_io_defs.h net: ena: fix indentations in ena_defs for better readability 2018-10-11 10:13:51 -07:00
ena_ethtool.c net: ena: make ena rxfh support ETH_RSS_HASH_NO_CHANGE 2020-03-05 16:43:47 +01:00
ena_netdev.c net: ena: set initial DMA width to avoid intel iommu issue 2020-12-02 08:49:52 +01:00
ena_netdev.h net/ena: Fix build warning in ena_xdp_set() 2020-05-27 17:46:32 +02:00
ena_pci_id_tbl.h
ena_regs_defs.h net: ena: fix indentations in ena_defs for better readability 2018-10-11 10:13:51 -07:00