mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 02:05:20 +07:00
7ad4263980
Current ACPI DMA configuration set-up device DMA capabilities through kernel defaults that do not take into account platform specific DMA configurations reported by firmware. By leveraging the ACPI acpi_dev_get_dma_resources() API, add code in acpi_dma_configure() to retrieve the DMA regions to correctly set-up PCI devices DMA parameters. Rework the ACPI IORT kernel API to make sure they can accommodate the DMA set-up required by firmware. By making PCI devices DMA set-up ACPI IORT specific, the kernel is shielded from unwanted regressions that could be triggered by parsing DMA resources on arches that were previously ignoring them (ie x86/ia64), leaving kernel behaviour unchanged on those arches. Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Acked-by: Will Deacon <will.deacon@arm.com> Tested-by: Nate Watterson <nwatters@codeaurora.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
58 lines
2.1 KiB
C
58 lines
2.1 KiB
C
/*
|
|
* Copyright (C) 2016, Semihalf
|
|
* Author: Tomasz Nowicki <tn@semihalf.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms and conditions of the GNU General Public License,
|
|
* version 2, as published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
* more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along with
|
|
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|
* Place - Suite 330, Boston, MA 02111-1307 USA.
|
|
*/
|
|
|
|
#ifndef __ACPI_IORT_H__
|
|
#define __ACPI_IORT_H__
|
|
|
|
#include <linux/acpi.h>
|
|
#include <linux/fwnode.h>
|
|
#include <linux/irqdomain.h>
|
|
|
|
#define IORT_IRQ_MASK(irq) (irq & 0xffffffffULL)
|
|
#define IORT_IRQ_TRIGGER_MASK(irq) ((irq >> 32) & 0xffffffffULL)
|
|
|
|
int iort_register_domain_token(int trans_id, struct fwnode_handle *fw_node);
|
|
void iort_deregister_domain_token(int trans_id);
|
|
struct fwnode_handle *iort_find_domain_token(int trans_id);
|
|
#ifdef CONFIG_ACPI_IORT
|
|
void acpi_iort_init(void);
|
|
u32 iort_msi_map_rid(struct device *dev, u32 req_id);
|
|
struct irq_domain *iort_get_device_domain(struct device *dev, u32 req_id);
|
|
void acpi_configure_pmsi_domain(struct device *dev);
|
|
int iort_pmsi_get_dev_id(struct device *dev, u32 *dev_id);
|
|
/* IOMMU interface */
|
|
void iort_dma_setup(struct device *dev, u64 *dma_addr, u64 *size);
|
|
const struct iommu_ops *iort_iommu_configure(struct device *dev);
|
|
#else
|
|
static inline void acpi_iort_init(void) { }
|
|
static inline u32 iort_msi_map_rid(struct device *dev, u32 req_id)
|
|
{ return req_id; }
|
|
static inline struct irq_domain *iort_get_device_domain(struct device *dev,
|
|
u32 req_id)
|
|
{ return NULL; }
|
|
static inline void acpi_configure_pmsi_domain(struct device *dev) { }
|
|
/* IOMMU interface */
|
|
static inline void iort_dma_setup(struct device *dev, u64 *dma_addr,
|
|
u64 *size) { }
|
|
static inline
|
|
const struct iommu_ops *iort_iommu_configure(struct device *dev)
|
|
{ return NULL; }
|
|
#endif
|
|
|
|
#endif /* __ACPI_IORT_H__ */
|