From patchwork Thu Sep 13 16:42:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Murphy X-Patchwork-Id: 10599831 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 73F526CB for ; Thu, 13 Sep 2018 16:48:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D26B2B106 for ; Thu, 13 Sep 2018 16:48:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F9462B117; Thu, 13 Sep 2018 16:48:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D37BF2B106 for ; Thu, 13 Sep 2018 16:48:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CnPAQioN3g1L7ju/cr9CWHYeD3Be3ZIj/iPJ+hudncM=; b=NORkuz8j5oVHUA ommPPZkxKZOKW4QNcmGI+JK6E6mpvdtNjmb6m1/GM/FA1fXh+VypjIYut/IgH5DdvnJPkhP9WI1TI mD00RdMzGY6Qyz57FX+dBVTyqDQsfNNRiyFNzgPfeC6aYWjiRunSJJ1EuLIxixGyBBfmjqsnGLF97 CpbCiryCvE/W3E+/yHULCnaZKTio/k8vjQ5CE8fKNj6RBke1BcdPgH5DcqWi51KAbcX9/Pn9G+cAh L21QzNZYqQA/jRoP2Dc4lLxg4iQfZtagINkowtNtBj/AgDMoi28APU76ISLBNCpGbG23m/RVzoXll uxyMOGqQ2jNtyQ8nX4Pg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g0Umd-00033A-5p; Thu, 13 Sep 2018 16:47:59 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g0Uhg-00083d-Js for linux-arm-kernel@lists.infradead.org; Thu, 13 Sep 2018 16:42:57 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 840251596; Thu, 13 Sep 2018 09:42:44 -0700 (PDT) Received: from e110467-lin.cambridge.arm.com (e110467-lin.emea.arm.com [10.4.12.131]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B96DF3F703; Thu, 13 Sep 2018 09:42:42 -0700 (PDT) From: Robin Murphy To: joro@8bytes.org, will.deacon@arm.com, thunder.leizhen@huawei.com, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 4/7] iommu/io-pgtable: Add helper for toggling non-strict mode Date: Thu, 13 Sep 2018 17:42:21 +0100 Message-Id: <63a2a074219ff045c4616b9f5680d0dd9e922b59.1536856828.git.robin.murphy@arm.com> X-Mailer: git-send-email 2.19.0.dirty In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180913_094252_736938_44348CF1 X-CRM114-Status: GOOD ( 13.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: john.garry@huawei.com, linuxarm@huawei.com, huawei.libin@huawei.com, guohanjun@huawei.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Since this might become a repeated idiom in drivers, let's add a tidy encapsulation from the outset. Signed-off-by: Robin Murphy --- drivers/iommu/io-pgtable.c | 9 +++++++++ drivers/iommu/io-pgtable.h | 1 + 2 files changed, 10 insertions(+) diff --git a/drivers/iommu/io-pgtable.c b/drivers/iommu/io-pgtable.c index 127558d83667..af9abe52cf06 100644 --- a/drivers/iommu/io-pgtable.c +++ b/drivers/iommu/io-pgtable.c @@ -77,3 +77,12 @@ void free_io_pgtable_ops(struct io_pgtable_ops *ops) io_pgtable_tlb_flush_all(iop); io_pgtable_init_table[iop->fmt]->free(iop); } + +void io_pgtable_set_non_strict(struct io_pgtable_ops *ops, bool val) { + struct io_pgtable *iop = io_pgtable_ops_to_pgtable(ops); + + if (val) + iop->cfg.quirks |= IO_PGTABLE_QUIRK_NON_STRICT; + else + iop->cfg.quirks &= ~IO_PGTABLE_QUIRK_NON_STRICT; +} diff --git a/drivers/iommu/io-pgtable.h b/drivers/iommu/io-pgtable.h index 47d5ae559329..0602a132655c 100644 --- a/drivers/iommu/io-pgtable.h +++ b/drivers/iommu/io-pgtable.h @@ -153,6 +153,7 @@ struct io_pgtable_ops *alloc_io_pgtable_ops(enum io_pgtable_fmt fmt, */ void free_io_pgtable_ops(struct io_pgtable_ops *ops); +void io_pgtable_set_non_strict(struct io_pgtable_ops *ops, bool val); /* * Internal structures for page table allocator implementations.