Skip to content

Commit

Permalink
hw/arm/smmu-common: Fix devfn computation in smmu_iommu_mr
Browse files Browse the repository at this point in the history
smmu_iommu_mr() aims at returning the IOMMUMemoryRegion corresponding
to a given sid. The function extracts both the PCIe bus number and
the devfn to return this data. Current computation of devfn is wrong
as it only returns the PCIe function instead of slot | function.

Fixes 32cfd7f ("hw/arm/smmuv3: Cache/invalidate config data")

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Message-id: 1530775623-32399-1-git-send-email-eric.auger@redhat.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
eauger authored and pm215 committed Jul 9, 2018
1 parent a98ff0e commit b78aae9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion hw/arm/smmu-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ IOMMUMemoryRegion *smmu_iommu_mr(SMMUState *s, uint32_t sid)
bus_n = PCI_BUS_NUM(sid);
smmu_bus = smmu_find_smmu_pcibus(s, bus_n);
if (smmu_bus) {
devfn = sid & 0x7;
devfn = SMMU_PCI_DEVFN(sid);
smmu = smmu_bus->pbdev[devfn];
if (smmu) {
return &smmu->iommu;
Expand Down
1 change: 1 addition & 0 deletions include/hw/arm/smmu-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#define SMMU_PCI_BUS_MAX 256
#define SMMU_PCI_DEVFN_MAX 256
#define SMMU_PCI_DEVFN(sid) (sid & 0xFF)

#define SMMU_MAX_VA_BITS 48

Expand Down

0 comments on commit b78aae9

Please sign in to comment.