mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-17 09:42:13 +07:00
staging: gasket: page table: remove code for "no dma_ops"
Remove code with TODOs on it for working around apparent problems previously seen in a qemu environment where dma_ops was not set correctly. There is no user of this in the current code. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
14d7022977
commit
758c579ec6
@ -916,7 +916,7 @@ static int gasket_enable_dev(
|
||||
&gasket_dev->bar_data[
|
||||
driver_desc->page_table_bar_index],
|
||||
&driver_desc->page_table_configs[tbl_idx],
|
||||
gasket_dev->dev, gasket_dev->pci_dev, true);
|
||||
gasket_dev->dev, gasket_dev->pci_dev);
|
||||
if (ret) {
|
||||
dev_err(gasket_dev->dev,
|
||||
"Couldn't init page table %d: %d\n",
|
||||
|
@ -212,12 +212,6 @@ struct gasket_page_table {
|
||||
* gasket_mmap function, so user_virt belongs in the driver anyhow.
|
||||
*/
|
||||
struct gasket_coherent_page_entry *coherent_pages;
|
||||
|
||||
/*
|
||||
* Whether the page table uses arch specific dma_ops or
|
||||
* whether the driver is supplying its own.
|
||||
*/
|
||||
bool dma_ops;
|
||||
};
|
||||
|
||||
/* Mapping declarations */
|
||||
@ -290,7 +284,7 @@ int gasket_page_table_init(
|
||||
struct gasket_page_table **ppg_tbl,
|
||||
const struct gasket_bar_data *bar_data,
|
||||
const struct gasket_page_table_config *page_table_config,
|
||||
struct device *device, struct pci_dev *pci_dev, bool has_dma_ops)
|
||||
struct device *device, struct pci_dev *pci_dev)
|
||||
{
|
||||
ulong bytes;
|
||||
struct gasket_page_table *pg_tbl;
|
||||
@ -353,7 +347,6 @@ int gasket_page_table_init(
|
||||
bar_data->virt_base[page_table_config->extended_reg]);
|
||||
pg_tbl->device = device;
|
||||
pg_tbl->pci_dev = pci_dev;
|
||||
pg_tbl->dma_ops = has_dma_ops;
|
||||
|
||||
dev_dbg(device, "Page table initialized successfully\n");
|
||||
|
||||
@ -759,33 +752,6 @@ static int gasket_map_extended_pages(
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO: dma_map_page() is not plugged properly when running under qemu. i.e.
|
||||
* dma_ops are not set properly, which causes the kernel to assert.
|
||||
*
|
||||
* This temporary hack allows the driver to work on qemu, but need to be fixed:
|
||||
* - either manually set the dma_ops for the architecture (which incidentally
|
||||
* can't be done in an out-of-tree module) - or get qemu to fill the device tree
|
||||
* properly so as linux plug the proper dma_ops or so as the driver can detect
|
||||
* that it is runnig on qemu
|
||||
*/
|
||||
static inline dma_addr_t _no_op_dma_map_page(
|
||||
struct device *dev, struct page *page, size_t offset, size_t size,
|
||||
enum dma_data_direction dir)
|
||||
{
|
||||
/*
|
||||
* struct dma_map_ops *ops = get_dma_ops(dev);
|
||||
* dma_addr_t addr;
|
||||
*
|
||||
* kmemcheck_mark_initialized(page_address(page) + offset, size);
|
||||
* BUG_ON(!valid_dma_direction(dir));
|
||||
* addr = ops->map_page(dev, page, offset, size, dir, NULL);
|
||||
* debug_dma_map_page(dev, page, offset, size, dir, addr, false);
|
||||
*/
|
||||
|
||||
return page_to_phys(page);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get and map last level page table buffers.
|
||||
* @pg_tbl: Gasket page table pointer.
|
||||
@ -856,16 +822,9 @@ static int gasket_perform_mapping(
|
||||
ptes[i].offset = offset;
|
||||
|
||||
/* Map the page into DMA space. */
|
||||
if (pg_tbl->dma_ops) {
|
||||
/* hook in to kernel map functions */
|
||||
ptes[i].dma_addr = dma_map_page(pg_tbl->device,
|
||||
page, 0, PAGE_SIZE, DMA_BIDIRECTIONAL);
|
||||
} else {
|
||||
ptes[i].dma_addr = _no_op_dma_map_page(
|
||||
pg_tbl->device, page, 0, PAGE_SIZE,
|
||||
DMA_BIDIRECTIONAL);
|
||||
}
|
||||
|
||||
ptes[i].dma_addr =
|
||||
dma_map_page(pg_tbl->device, page, 0, PAGE_SIZE,
|
||||
DMA_BIDIRECTIONAL);
|
||||
dev_dbg(pg_tbl->device,
|
||||
"%s i %d pte %p pfn %p -> mapped %llx\n",
|
||||
__func__, i, &ptes[i],
|
||||
@ -1042,13 +1001,8 @@ static int gasket_alloc_extended_subtable(
|
||||
}
|
||||
|
||||
/* Map the page into DMA space. */
|
||||
if (pg_tbl->dma_ops) {
|
||||
pte->dma_addr = dma_map_page(pg_tbl->device, pte->page, 0,
|
||||
PAGE_SIZE, DMA_BIDIRECTIONAL);
|
||||
} else {
|
||||
pte->dma_addr = _no_op_dma_map_page(pg_tbl->device, pte->page,
|
||||
0, PAGE_SIZE, DMA_BIDIRECTIONAL);
|
||||
}
|
||||
pte->dma_addr = dma_map_page(pg_tbl->device, pte->page, 0, PAGE_SIZE,
|
||||
DMA_BIDIRECTIONAL);
|
||||
/* Wait until the page is mapped. */
|
||||
mb();
|
||||
|
||||
|
@ -37,7 +37,6 @@ struct gasket_page_table;
|
||||
* translation table.
|
||||
* @device: Device structure for the underlying device. Only used for logging.
|
||||
* @pci_dev: PCI system descriptor for the underlying device.
|
||||
* @bool has_dma_ops: Whether the page table uses arch specific dma_ops or
|
||||
* whether the driver will supply its own.
|
||||
*
|
||||
* Description: Allocates and initializes data to track address translation -
|
||||
@ -51,7 +50,7 @@ int gasket_page_table_init(
|
||||
struct gasket_page_table **ppg_tbl,
|
||||
const struct gasket_bar_data *bar_data,
|
||||
const struct gasket_page_table_config *page_table_config,
|
||||
struct device *device, struct pci_dev *pci_dev, bool dma_ops);
|
||||
struct device *device, struct pci_dev *pci_dev);
|
||||
|
||||
/*
|
||||
* Deallocate and cleanup page table data.
|
||||
|
Loading…
Reference in New Issue
Block a user