From nobody Tue Nov 18 07:41:49 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1608889928; cv=none; d=zohomail.com; s=zohoarc; b=bcp9DOqEPvuSaZSek2SblZL4hHgliTd79jQc4chi/Bq9QrkRQhWVCIvikFtcmmF62bW4dOL05aulm2v7C0BNt43DsqMmhVY/9YuFpbKBREnahwIlvB+5LPuJarZyYxVh1Q3h3RmHB6pfBxWCGVEdAJsh7gSz1do9AQ/g4UIZYqA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608889928; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=BfKAYogb3o6ZXhVJEmYpNFHBtwl3uF/E70Ieu82QiYM=; b=QOf2jJ9nxF2AfCq4hMJ95KdvaCGcXiws3IUwmybsnbPyxQf7JwsmMEmfAU9OlSyVPL0iN3uZWBqBusfMJKV3YU3EiBkHqvjKAd4lCBaBt+7nYlZp2ltf9ELN3rtgqZwHbnjnZeouztKwmon+z0k7Kkzczn5f6kfpE3tusSqYls4= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608889928683754.9302497005431; Fri, 25 Dec 2020 01:52:08 -0800 (PST) Received: from localhost ([::1]:57610 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ksjlT-00067M-Co for importer@patchew.org; Fri, 25 Dec 2020 04:52:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44804) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ksjkD-0005Zq-Pa; Fri, 25 Dec 2020 04:50:45 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:2573) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ksjkB-0003OE-0z; Fri, 25 Dec 2020 04:50:45 -0500 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4D2McL3ddyzhwsq; Fri, 25 Dec 2020 17:49:54 +0800 (CST) Received: from DESKTOP-8RFUVS3.china.huawei.com (10.174.185.179) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.498.0; Fri, 25 Dec 2020 17:50:20 +0800 From: Zenghui Yu To: , , , Subject: [PATCH] hw/arm/smmuv3: Fix addr_mask for range-based invalidation Date: Fri, 25 Dec 2020 17:50:15 +0800 Message-ID: <20201225095015.609-1-yuzenghui@huawei.com> X-Mailer: git-send-email 2.23.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.185.179] X-CFilter-Loop: Reflected Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=45.249.212.32; envelope-from=yuzenghui@huawei.com; helo=szxga06-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Zenghui Yu , wanghaibin.wang@huawei.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" When performing range-based IOTLB invalidation, we should decode the TG field into the corresponding translation granule size so that we can pass the correct invalidation range to backend. Set @granule to (tg * 2 + 10) to properly emulate the architecture. Fixes: d52915616c05 ("hw/arm/smmuv3: Get prepared for range invalidation") Signed-off-by: Zenghui Yu --- hw/arm/smmuv3.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c index bbca0e9f20..65231c7d52 100644 --- a/hw/arm/smmuv3.c +++ b/hw/arm/smmuv3.c @@ -801,7 +801,7 @@ static void smmuv3_notify_iova(IOMMUMemoryRegion *mr, { SMMUDevice *sdev =3D container_of(mr, SMMUDevice, iommu); IOMMUTLBEvent event; - uint8_t granule =3D tg; + uint8_t granule; =20 if (!tg) { SMMUEventInfo event =3D {.inval_ste_allowed =3D true}; @@ -821,6 +821,8 @@ static void smmuv3_notify_iova(IOMMUMemoryRegion *mr, return; } granule =3D tt->granule_sz; + } else { + guanule =3D tg * 2 + 10; } =20 event.type =3D IOMMU_NOTIFIER_UNMAP; --=20 2.19.1