未验证 提交 d8fcd2f3 编写于 作者: O openeuler-ci-bot 提交者: Gitee

!897 LoongArch: improve dma ops and interrupt process

Merge Pull Request from: @Hongchen_Zhang 
 
1. Add swiotlb backups buffer
2. Add ARCH_HAS_SETUP_DMA_OPS and DMA_OPS
3. pci: irq: Add early_param pci_irq_limit to limit pci irq numbers 
 
Link:https://gitee.com/openeuler/kernel/pulls/897 

Reviewed-by: Guo Dongtai <guodongtai@kylinos.cn> 
Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com> 
......@@ -113,6 +113,8 @@ config LOONGARCH
select MODULES_USE_ELF_RELA if MODULES
select NEED_PER_CPU_EMBED_FIRST_CHUNK
select NEED_PER_CPU_PAGE_FIRST_CHUNK
select DMA_OPS
select ARCH_HAS_SETUP_DMA_OPS
select OF
select OF_EARLY_FLATTREE
select PCI
......
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2020 Loongson Technology Corporation Limited
*/
#ifndef _ASM_DMA_MAPPING_H
#define _ASM_DMA_MAPPING_H
extern const struct dma_map_ops loongson_dma_ops;
extern bool swiotlb_need_fix;
extern phys_addr_t io_tlb_start;
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
{
if (swiotlb_need_fix)
return &loongson_dma_ops;
else
return NULL;
}
#endif /* _ASM_DMA_MAPPING_H */
此差异已折叠。
......@@ -1107,12 +1107,32 @@ int pci_msi_enabled(void)
}
EXPORT_SYMBOL(pci_msi_enabled);
#ifdef CONFIG_LOONGARCH
static unsigned int pci_irq_numbers = 32;
static int __init pci_irq_limit(char *str)
{
get_option(&str, &pci_irq_numbers);
if (pci_irq_numbers == 0)
pci_irq_numbers = 32;
return 0;
}
early_param("pci_irq_limit", pci_irq_limit);
#endif
static int __pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec,
struct irq_affinity *affd)
{
int nvec;
int rc;
#ifdef CONFIG_LOONGARCH
if (maxvec > 32)
maxvec = pci_irq_numbers;
#endif
if (!pci_msi_supported(dev, minvec) || dev->current_state != PCI_D0)
return -EINVAL;
......@@ -1174,6 +1194,11 @@ static int __pci_enable_msix_range(struct pci_dev *dev,
{
int rc, nvec = maxvec;
#ifdef CONFIG_LOONGARCH
if (maxvec > 32)
nvec = pci_irq_numbers;
#endif
if (maxvec < minvec)
return -ERANGE;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册