mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-23 05:57:33 +00:00
HV: simplified the logic of iommu_read/write64
hv: vtd: simplified the logic of iommu_read/write64 Tracked-On: #4535 Signed-off-by: Qian Wang <qian1.wang@intel.com> Reviewed-by: Binbin Wu <binbin.wu@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
a1e081073f
commit
c2bcf9fade
@ -237,13 +237,7 @@ static uint32_t iommu_read32(const struct dmar_drhd_rt *dmar_unit, uint32_t offs
|
|||||||
|
|
||||||
static uint64_t iommu_read64(const struct dmar_drhd_rt *dmar_unit, uint32_t offset)
|
static uint64_t iommu_read64(const struct dmar_drhd_rt *dmar_unit, uint32_t offset)
|
||||||
{
|
{
|
||||||
uint64_t value;
|
return mmio_read64(hpa2hva(dmar_unit->drhd->reg_base_addr + offset));
|
||||||
|
|
||||||
value = mmio_read32(hpa2hva(dmar_unit->drhd->reg_base_addr + offset + 4U));
|
|
||||||
value = value << 32U;
|
|
||||||
value = value | mmio_read32(hpa2hva(dmar_unit->drhd->reg_base_addr + offset));
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void iommu_write32(const struct dmar_drhd_rt *dmar_unit, uint32_t offset, uint32_t value)
|
static void iommu_write32(const struct dmar_drhd_rt *dmar_unit, uint32_t offset, uint32_t value)
|
||||||
@ -253,13 +247,7 @@ static void iommu_write32(const struct dmar_drhd_rt *dmar_unit, uint32_t offset,
|
|||||||
|
|
||||||
static void iommu_write64(const struct dmar_drhd_rt *dmar_unit, uint32_t offset, uint64_t value)
|
static void iommu_write64(const struct dmar_drhd_rt *dmar_unit, uint32_t offset, uint64_t value)
|
||||||
{
|
{
|
||||||
uint32_t temp;
|
mmio_write64(value, hpa2hva(dmar_unit->drhd->reg_base_addr + offset));
|
||||||
|
|
||||||
temp = (uint32_t)value;
|
|
||||||
mmio_write32(temp, hpa2hva(dmar_unit->drhd->reg_base_addr + offset));
|
|
||||||
|
|
||||||
temp = (uint32_t)(value >> 32U);
|
|
||||||
mmio_write32(temp, hpa2hva(dmar_unit->drhd->reg_base_addr + offset + 4U));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void dmar_wait_completion(const struct dmar_drhd_rt *dmar_unit, uint32_t offset,
|
static inline void dmar_wait_completion(const struct dmar_drhd_rt *dmar_unit, uint32_t offset,
|
||||||
|
Loading…
Reference in New Issue
Block a user