mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-15 11:46:44 +07:00
18b709beb5
The introduction of acpi_dma_configure() allows to configure DMA and related IOMMU for any device that is DMA capable. To achieve that goal it ensures DMA masks are set-up to sane default values before proceeding with IOMMU and DMA ops configuration. On x86/ia64 systems, through acpi_bind_one(), acpi_dma_configure() is called for every device that has an ACPI companion, in that every device is considered DMA capable on x86/ia64 systems (ie acpi_get_dma_attr() API), which has the side effect of initializing dma masks also for pseudo-devices (eg CPUs and memory nodes) and potentially for devices whose dma masks were not set-up before the acpi_dma_configure() API was introduced, which may have noxious side effects. Therefore, in preparation for IORT firmware specific DMA masks set-up, wrap the default DMA masks set-up in acpi_dma_configure() inside an IORT specific wrapper that reverts to a NOP on x86/ia64 systems, restoring the default expected behaviour on x86/ia64 systems and keeping DMA default masks set-up on IORT based (ie ARM) arch configurations. Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Acked-by: Will Deacon <will.deacon@arm.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Hanjun Guo <hanjun.guo@linaro.org> Tested-by: Hanjun Guo <hanjun.guo@linaro.org> Cc: Will Deacon <will.deacon@arm.com> Cc: Hanjun Guo <hanjun.guo@linaro.org> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Robin Murphy <robin.murphy@arm.com> Cc: Tomasz Nowicki <tn@semihalf.com> Cc: Joerg Roedel <joro@8bytes.org> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> Cc: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Joerg Roedel <jroedel@suse.de>
59 lines
2.1 KiB
C
59 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);
|
|
bool iort_node_match(u8 type);
|
|
u32 iort_msi_map_rid(struct device *dev, u32 req_id);
|
|
struct irq_domain *iort_get_device_domain(struct device *dev, u32 req_id);
|
|
/* IOMMU interface */
|
|
void iort_set_dma_mask(struct device *dev);
|
|
const struct iommu_ops *iort_iommu_configure(struct device *dev);
|
|
#else
|
|
static inline void acpi_iort_init(void) { }
|
|
static inline bool iort_node_match(u8 type) { return false; }
|
|
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; }
|
|
/* IOMMU interface */
|
|
static inline void iort_set_dma_mask(struct device *dev) { }
|
|
static inline
|
|
const struct iommu_ops *iort_iommu_configure(struct device *dev)
|
|
{ return NULL; }
|
|
#endif
|
|
|
|
#define IORT_ACPI_DECLARE(name, table_id, fn) \
|
|
ACPI_DECLARE_PROBE_ENTRY(iort, name, table_id, 0, NULL, 0, fn)
|
|
|
|
#endif /* __ACPI_IORT_H__ */
|