mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-26 07:21:37 +00:00
hv: vtd: use pre-defined function for bdf calculation
Use pre-defined inline function for pci bus/slot/function calculation. Tracked-on: #1747 Signed-off-by: Binbin Wu <binbin.wu@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
039a1c0f2e
commit
0800624fe5
@ -748,9 +748,9 @@ static void fault_record_analysis(__unused uint64_t low, uint64_t high)
|
|||||||
pr_info("%s, Reason: 0x%x, SID: %x.%x.%x @0x%llx",
|
pr_info("%s, Reason: 0x%x, SID: %x.%x.%x @0x%llx",
|
||||||
(dma_frcd_up_t(high) != 0U) ? "Read/Atomic" : "Write",
|
(dma_frcd_up_t(high) != 0U) ? "Read/Atomic" : "Write",
|
||||||
dma_frcd_up_fr(high),
|
dma_frcd_up_fr(high),
|
||||||
dma_frcd_up_sid(high) >> 8U,
|
pci_bus(dma_frcd_up_sid(high)),
|
||||||
(dma_frcd_up_sid(high) >> 3U) & 0x1fUL,
|
pci_slot(dma_frcd_up_sid(high)),
|
||||||
dma_frcd_up_sid(high) & 0x7UL,
|
pci_func(dma_frcd_up_sid(high)),
|
||||||
low);
|
low);
|
||||||
#if DBG_IOMMU
|
#if DBG_IOMMU
|
||||||
if (iommu_ecap_dt(dmar_uint->ecap)i != 0U) {
|
if (iommu_ecap_dt(dmar_uint->ecap)i != 0U) {
|
||||||
@ -930,13 +930,13 @@ static int add_iommu_device(const struct iommu_domain *domain, uint16_t segment,
|
|||||||
dmar_uint = device_to_dmaru(segment, bus, devfun);
|
dmar_uint = device_to_dmaru(segment, bus, devfun);
|
||||||
if (dmar_uint == NULL) {
|
if (dmar_uint == NULL) {
|
||||||
pr_err("no dmar unit found for device:0x%x:%x.%x",
|
pr_err("no dmar unit found for device:0x%x:%x.%x",
|
||||||
bus, devfun >> 3U, devfun & 0x7U);
|
bus, pci_slot(devfun), pci_func(devfun));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dmar_uint->drhd->ignore) {
|
if (dmar_uint->drhd->ignore) {
|
||||||
dev_dbg(ACRN_DBG_IOMMU, "device is ignored :0x%x:%x.%x",
|
dev_dbg(ACRN_DBG_IOMMU, "device is ignored :0x%x:%x.%x",
|
||||||
bus, devfun >> 3U, devfun & 0x7U);
|
bus, pci_slot(devfun), pci_func(devfun));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -992,7 +992,7 @@ static int add_iommu_device(const struct iommu_domain *domain, uint16_t segment,
|
|||||||
pr_err("%s: context entry@0x%llx (Lower:%x) ",
|
pr_err("%s: context entry@0x%llx (Lower:%x) ",
|
||||||
__func__, context_entry, context_entry->lower);
|
__func__, context_entry, context_entry->lower);
|
||||||
pr_err("already present for %x:%x.%x",
|
pr_err("already present for %x:%x.%x",
|
||||||
bus, devfun >> 3U, devfun & 0x7U);
|
bus, pci_slot(devfun), pci_func(devfun));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,9 +430,9 @@ static inline bool dma_frcd_up_priv(uint64_t up_priv)
|
|||||||
return (((up_priv >> 29U) & 1UL) == 1UL);
|
return (((up_priv >> 29U) & 1UL) == 1UL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t dma_frcd_up_sid(uint64_t up_sid)
|
static inline uint16_t dma_frcd_up_sid(uint64_t up_sid)
|
||||||
{
|
{
|
||||||
return ((uint32_t)up_sid & 0xffffU);
|
return ((uint16_t)up_sid & 0xffffU);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DMAR_CONTEXT_TRANSLATION_TYPE_TRANSLATED 0x00U
|
#define DMAR_CONTEXT_TRANSLATION_TYPE_TRANSLATED 0x00U
|
||||||
|
Loading…
Reference in New Issue
Block a user