From nobody Sat Feb 7 05:24:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531144590959231.31565651106598; Mon, 9 Jul 2018 06:56:30 -0700 (PDT) Received: from localhost ([::1]:42192 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWeT-0000Qs-NA for importer@patchew.org; Mon, 09 Jul 2018 09:56:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48129) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWcj-0007eO-6I for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcWci-00050v-F0 for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:41 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:43336) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcWci-0004zS-7Q for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:40 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1fcWcf-0000gM-3Q for qemu-devel@nongnu.org; Mon, 09 Jul 2018 14:54:37 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 9 Jul 2018 14:54:25 +0100 Message-Id: <20180709135435.836-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709135435.836-1-peter.maydell@linaro.org> References: <20180709135435.836-1-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 01/11] hw/arm/smmu-common: Fix devfn computation in smmu_iommu_mr X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Eric Auger 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 32cfd7f39e08 ("hw/arm/smmuv3: Cache/invalidate config data") Signed-off-by: Eric Auger Message-id: 1530775623-32399-1-git-send-email-eric.auger@redhat.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- include/hw/arm/smmu-common.h | 1 + hw/arm/smmu-common.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h index 50e2912a95e..b07cadd0ef9 100644 --- a/include/hw/arm/smmu-common.h +++ b/include/hw/arm/smmu-common.h @@ -24,6 +24,7 @@ =20 #define SMMU_PCI_BUS_MAX 256 #define SMMU_PCI_DEVFN_MAX 256 +#define SMMU_PCI_DEVFN(sid) (sid & 0xFF) =20 #define SMMU_MAX_VA_BITS 48 =20 diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c index 3098915d07c..55c75d65d2e 100644 --- a/hw/arm/smmu-common.c +++ b/hw/arm/smmu-common.c @@ -351,7 +351,7 @@ IOMMUMemoryRegion *smmu_iommu_mr(SMMUState *s, uint32_t= sid) bus_n =3D PCI_BUS_NUM(sid); smmu_bus =3D smmu_find_smmu_pcibus(s, bus_n); if (smmu_bus) { - devfn =3D sid & 0x7; + devfn =3D SMMU_PCI_DEVFN(sid); smmu =3D smmu_bus->pbdev[devfn]; if (smmu) { return &smmu->iommu; --=20 2.17.1