From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAB3DC433B4 for ; Wed, 19 May 2021 10:03:35 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9139C61073 for ; Wed, 19 May 2021 10:03:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9139C61073 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:Cc:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2QfmpABtSryfoPzqskW9y38y1OWj/6MFo+G54XB2u7Y=; b=k4T/mDcoaji9RsyPEl5bhvIuW GBUbqRg71ABDaidQZ39HvpmoWtbosFArWrMb9NB7OnFH1rzFFSbkizOnEStrQ8YLWtEjfpV/nwAvX qGesdZpD71CHG46gvqxet1TxzGadtH1TXMw1Rf0RAgZ5DbqIxM/tZEN/rPyFZNDfF4HA0OiJ67n+/ Y1F1dx1QqIBlEK9cmmnM1Sq75osrlK4onCktc395T9MDcApVm/henCxbgxhDeCMemi4n3DUdXvVy6 mxd7DTq/0ouoOsOnkbyR6Pj/rVv7ER20KTCOrhCpDcZ90/yVZ7ClnPhpjXWJZz1aRLQLk4CdUAOfn I8VR/fPaA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ljJ1P-003Yaw-Ar; Wed, 19 May 2021 10:01:47 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljJ1N-003YaV-8z for linux-arm-kernel@desiato.infradead.org; Wed, 19 May 2021 10:01:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To: Subject:Sender:Reply-To:Content-ID:Content-Description; bh=YSAcuOLJGeEoeLeynUv7Z53TmAqhXg2HFE2m7g0ca6g=; b=tHsWPToYvSgODNeVkYRBP8dVpY moHFeBzqKgySpMZlMSYk9juyWCXU+VnVeftsZ/nRFh7F2hv7lon0ELaVkahA9pmxCTB21kbMcNcN+ OLITuAb2g5VXij/f1ZrDf3eaN1I5anLwR/3iz00viiZzDjvh+AwHxbp14nQsatf5mFcECwE7nUtEw yZA6zT9yaiDO0txd3bySCr8VqEpG+c7HG5Ec1A0egPS3kdgY25yr5OrFg2CuCdOqQkkgl6H2ajUn5 OvBhYu03xDVlCs6hPBgIE+HN9B8KBHPM0sG1ydXi1AaEouupGFonFEdmhOeMPmdzpoLHxyt9WWBNA Xyp/LhZw==; Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ljJ1K-00FLQ7-Fm for linux-arm-kernel@lists.infradead.org; Wed, 19 May 2021 10:01:43 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B74F3101E; Wed, 19 May 2021 03:01:39 -0700 (PDT) Received: from [10.57.66.179] (unknown [10.57.66.179]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8E03A3F719; Wed, 19 May 2021 03:01:38 -0700 (PDT) Subject: Re: [RFC PATCH v1 0/2] iommu/arm-smmu-v3: Add some parameter check in __arm_smmu_tlb_inv_range() To: Kunkun Jiang , Will Deacon , Eric Auger , "moderated list:ARM SMMU DRIVERS" , "open list:IOMMU DRIVERS" , open list Cc: wanghaibin.wang@huawei.com References: <20210519094307.3275-1-jiangkunkun@huawei.com> From: Robin Murphy Message-ID: Date: Wed, 19 May 2021 11:01:33 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210519094307.3275-1-jiangkunkun@huawei.com> Content-Language: en-GB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210519_030142_623818_81622123 X-CRM114-Status: GOOD ( 19.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2021-05-19 10:43, Kunkun Jiang wrote: > Hi all, > > This set of patches solves some errors when I tested the SMMU nested mode. > > Test scenario description: > guest kernel: 4KB translation granule > host kernel: 16KB translation granule > > errors: > 1. encountered an endless loop in __arm_smmu_tlb_inv_range because > num_pages is 0 > 2. encountered CERROR_ILL because the fields of TLB invalidation > command are as follow: TG = 2, NUM = 0, SCALE = 0, TTL = 0. The > combination is exactly the kind of reserved combination pointed > out in the SMMUv3 spec(page 143-144, version D.a) > > In my opinion, it is more appropriate to add parameter check in > __arm_smmu_tlb_inv_range(), although these problems only appeared > when I tested the SMMU nested mode. What do you think? FWIW I think it would be better to fix the caller to not issue broken commands in the first place. The kernel shouldn't do so for itself (and definitely needs fixing if it ever does), so it sounds like the nesting implementation needs to do a bit more validation of what it's passing through. Robin. > This series include patches as below: > Patch 1: > - align the invalid range with leaf page size upwards when smmu > supports RIL > > Patch 2: > - add a check to standardize granule size when smmu supports RIL > > Kunkun Jiang (2): > iommu/arm-smmu-v3: Align invalid range with leaf page size upwards > when support RIL > iommu/arm-smmu-v3: Standardize granule size when support RIL > > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel