From patchwork Tue Dec 22 00:44:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Isaac J. Manjarres" X-Patchwork-Id: 11985541 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 8CE6FC43217 for ; Tue, 22 Dec 2020 00:46:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6B69E22B2B for ; Tue, 22 Dec 2020 00:46:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726586AbgLVApw (ORCPT ); Mon, 21 Dec 2020 19:45:52 -0500 Received: from so254-31.mailgun.net ([198.61.254.31]:48124 "EHLO so254-31.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726320AbgLVApv (ORCPT ); Mon, 21 Dec 2020 19:45:51 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1608597926; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=3dHzP+nMpSbubafshldwZwiKbvHCmHm8swq4BV3nnEw=; b=QvB62l/HuHgQPnASpGF9+hjhE/Dj0+3CtfNUMXEplHwsMscLIzkKfruMYfC5lhgwNxd46ywd CSm2K5Q9wGWMZRp0S5fi7LzX9BxsMJjRL+DHTUhJK/AeHVibrgITjqYEweMtZVyknSGbDlV6 ABsRRIAUidfAbG6iQC3Nz1s62/s= X-Mailgun-Sending-Ip: 198.61.254.31 X-Mailgun-Sid: WyI1MzIzYiIsICJsaW51eC1hcm0tbXNtQHZnZXIua2VybmVsLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n09.prod.us-east-1.postgun.com with SMTP id 5fe14181e61d77c9713c69fe (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 22 Dec 2020 00:44:49 GMT Sender: isaacm=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 2B1D4C43463; Tue, 22 Dec 2020 00:44:49 +0000 (UTC) Received: from isaacm-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: isaacm) by smtp.codeaurora.org (Postfix) with ESMTPSA id 1CCBFC433C6; Tue, 22 Dec 2020 00:44:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1CCBFC433C6 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=isaacm@codeaurora.org From: "Isaac J. Manjarres" To: iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: "Isaac J. Manjarres" , will@kernel.org, joro@8bytes.org, pdaly@codeaurora.org, pratikp@codeaurora.org, kernel-team@android.com, robin.murphy@arm.com Subject: [PATCH v2 1/7] iommu/io-pgtable: Introduce dynamic io-pgtable fmt registration Date: Mon, 21 Dec 2020 16:44:30 -0800 Message-Id: <1608597876-32367-2-git-send-email-isaacm@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1608597876-32367-1-git-send-email-isaacm@codeaurora.org> References: <1608597876-32367-1-git-send-email-isaacm@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The io-pgtable code constructs an array of init functions for each page table format at compile time. This is not ideal, as this increases the footprint of the io-pgtable code, as well as prevents io-pgtable formats from being built as kernel modules. In preparation for modularizing the io-pgtable formats, switch to a dynamic registration scheme, where each io-pgtable format can register their init functions with the io-pgtable code at boot or module insertion time. Signed-off-by: Isaac J. Manjarres Reported-by: kernel test robot --- drivers/iommu/io-pgtable-arm-v7s.c | 34 +++++++++++++- drivers/iommu/io-pgtable-arm.c | 90 ++++++++++++++++++++++++++---------- drivers/iommu/io-pgtable.c | 94 ++++++++++++++++++++++++++++++++------ include/linux/io-pgtable.h | 51 +++++++++++++-------- 4 files changed, 209 insertions(+), 60 deletions(-) diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c index 1d92ac9..89aad2f 100644 --- a/drivers/iommu/io-pgtable-arm-v7s.c +++ b/drivers/iommu/io-pgtable-arm-v7s.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -835,7 +836,8 @@ static struct io_pgtable *arm_v7s_alloc_pgtable(struct io_pgtable_cfg *cfg, return NULL; } -struct io_pgtable_init_fns io_pgtable_arm_v7s_init_fns = { +static struct io_pgtable_init_fns io_pgtable_arm_v7s_init_fns = { + .fmt = ARM_V7S, .alloc = arm_v7s_alloc_pgtable, .free = arm_v7s_free_pgtable, }; @@ -982,5 +984,33 @@ static int __init arm_v7s_do_selftests(void) pr_info("self test ok\n"); return 0; } -subsys_initcall(arm_v7s_do_selftests); +#else +static int arm_v7s_do_selftests(void) +{ + return 0; +} #endif + +static int __init arm_v7s_init(void) +{ + int ret; + + ret = io_pgtable_ops_register(&io_pgtable_arm_v7s_init_fns); + if (ret < 0) { + pr_err("Failed to register ARM V7S format\n"); + return ret; + } + + ret = arm_v7s_do_selftests(); + if (ret < 0) + io_pgtable_ops_unregister(&io_pgtable_arm_v7s_init_fns); + + return ret; +} +core_initcall(arm_v7s_init); + +static void __exit arm_v7s_exit(void) +{ + io_pgtable_ops_unregister(&io_pgtable_arm_v7s_init_fns); +} +module_exit(arm_v7s_exit); diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c index 87def58..ff0ea2f 100644 --- a/drivers/iommu/io-pgtable-arm.c +++ b/drivers/iommu/io-pgtable-arm.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -1043,29 +1044,32 @@ arm_mali_lpae_alloc_pgtable(struct io_pgtable_cfg *cfg, void *cookie) return NULL; } -struct io_pgtable_init_fns io_pgtable_arm_64_lpae_s1_init_fns = { - .alloc = arm_64_lpae_alloc_pgtable_s1, - .free = arm_lpae_free_pgtable, -}; - -struct io_pgtable_init_fns io_pgtable_arm_64_lpae_s2_init_fns = { - .alloc = arm_64_lpae_alloc_pgtable_s2, - .free = arm_lpae_free_pgtable, -}; - -struct io_pgtable_init_fns io_pgtable_arm_32_lpae_s1_init_fns = { - .alloc = arm_32_lpae_alloc_pgtable_s1, - .free = arm_lpae_free_pgtable, -}; - -struct io_pgtable_init_fns io_pgtable_arm_32_lpae_s2_init_fns = { - .alloc = arm_32_lpae_alloc_pgtable_s2, - .free = arm_lpae_free_pgtable, -}; - -struct io_pgtable_init_fns io_pgtable_arm_mali_lpae_init_fns = { - .alloc = arm_mali_lpae_alloc_pgtable, - .free = arm_lpae_free_pgtable, +static struct io_pgtable_init_fns io_pgtable_arm_lpae_init_fns[] = { + { + .fmt = ARM_32_LPAE_S1, + .alloc = arm_32_lpae_alloc_pgtable_s1, + .free = arm_lpae_free_pgtable, + }, + { + .fmt = ARM_32_LPAE_S2, + .alloc = arm_32_lpae_alloc_pgtable_s2, + .free = arm_lpae_free_pgtable, + }, + { + .fmt = ARM_64_LPAE_S1, + .alloc = arm_64_lpae_alloc_pgtable_s1, + .free = arm_lpae_free_pgtable, + }, + { + .fmt = ARM_64_LPAE_S2, + .alloc = arm_64_lpae_alloc_pgtable_s2, + .free = arm_lpae_free_pgtable, + }, + { + .fmt = ARM_MALI_LPAE, + .alloc = arm_mali_lpae_alloc_pgtable, + .free = arm_lpae_free_pgtable, + }, }; #ifdef CONFIG_IOMMU_IO_PGTABLE_LPAE_SELFTEST @@ -1250,5 +1254,43 @@ static int __init arm_lpae_do_selftests(void) pr_info("selftest: completed with %d PASS %d FAIL\n", pass, fail); return fail ? -EFAULT : 0; } -subsys_initcall(arm_lpae_do_selftests); +#else +static int __init arm_lpae_do_selftests(void) +{ + return 0; +} #endif + +static int __init arm_lpae_init(void) +{ + int ret, i; + + for (i = 0; i < ARRAY_SIZE(io_pgtable_arm_lpae_init_fns); i++) { + ret = io_pgtable_ops_register(&io_pgtable_arm_lpae_init_fns[i]); + if (ret < 0) { + pr_err("Failed to register ARM LPAE fmt: %d\n"); + goto err_io_pgtable_register; + } + } + + ret = arm_lpae_do_selftests(); + if (ret < 0) + goto err_io_pgtable_register; + + return 0; + +err_io_pgtable_register: + for (i = i - 1; i >= 0; i--) + io_pgtable_ops_unregister(&io_pgtable_arm_lpae_init_fns[i]); + return ret; +} +core_initcall(arm_lpae_init); + +static void __exit arm_lpae_exit(void) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(io_pgtable_arm_lpae_init_fns); i++) + io_pgtable_ops_unregister(&io_pgtable_arm_lpae_init_fns[i]); +} +module_exit(arm_lpae_exit); diff --git a/drivers/iommu/io-pgtable.c b/drivers/iommu/io-pgtable.c index 94394c8..2c6eb2e 100644 --- a/drivers/iommu/io-pgtable.c +++ b/drivers/iommu/io-pgtable.c @@ -10,33 +10,45 @@ #include #include #include +#include +#include #include -static const struct io_pgtable_init_fns * -io_pgtable_init_table[IO_PGTABLE_NUM_FMTS] = { -#ifdef CONFIG_IOMMU_IO_PGTABLE_LPAE - [ARM_32_LPAE_S1] = &io_pgtable_arm_32_lpae_s1_init_fns, - [ARM_32_LPAE_S2] = &io_pgtable_arm_32_lpae_s2_init_fns, - [ARM_64_LPAE_S1] = &io_pgtable_arm_64_lpae_s1_init_fns, - [ARM_64_LPAE_S2] = &io_pgtable_arm_64_lpae_s2_init_fns, - [ARM_MALI_LPAE] = &io_pgtable_arm_mali_lpae_init_fns, -#endif -#ifdef CONFIG_IOMMU_IO_PGTABLE_ARMV7S - [ARM_V7S] = &io_pgtable_arm_v7s_init_fns, -#endif +struct io_pgtable_init_fns_node { + struct io_pgtable_init_fns *fns; + struct list_head list; }; +static LIST_HEAD(io_pgtable_init_fns_list); +static DEFINE_RWLOCK(io_pgtable_init_fns_list_lock); + +static struct io_pgtable_init_fns *io_pgtable_get_init_fns(enum io_pgtable_fmt fmt) +{ + struct io_pgtable_init_fns_node *iter; + struct io_pgtable_init_fns *fns = NULL; + + read_lock(&io_pgtable_init_fns_list_lock); + list_for_each_entry(iter, &io_pgtable_init_fns_list, list) + if (iter->fns->fmt == fmt) { + fns = iter->fns; + break; + } + read_unlock(&io_pgtable_init_fns_list_lock); + + return fns; +} + struct io_pgtable_ops *alloc_io_pgtable_ops(enum io_pgtable_fmt fmt, struct io_pgtable_cfg *cfg, void *cookie) { struct io_pgtable *iop; - const struct io_pgtable_init_fns *fns; + struct io_pgtable_init_fns *fns; if (fmt >= IO_PGTABLE_NUM_FMTS) return NULL; - fns = io_pgtable_init_table[fmt]; + fns = io_pgtable_get_init_fns(fmt); if (!fns) return NULL; @@ -59,12 +71,64 @@ EXPORT_SYMBOL_GPL(alloc_io_pgtable_ops); void free_io_pgtable_ops(struct io_pgtable_ops *ops) { struct io_pgtable *iop; + struct io_pgtable_init_fns *fns; if (!ops) return; iop = io_pgtable_ops_to_pgtable(ops); io_pgtable_tlb_flush_all(iop); - io_pgtable_init_table[iop->fmt]->free(iop); + fns = io_pgtable_get_init_fns(iop->fmt); + if (fns) + fns->free(iop); } EXPORT_SYMBOL_GPL(free_io_pgtable_ops); + +int io_pgtable_ops_register(struct io_pgtable_init_fns *init_fns) +{ + struct io_pgtable_init_fns_node *iter, *fns_node; + int ret = 0; + + if (!init_fns || init_fns->fmt >= IO_PGTABLE_NUM_FMTS || + !init_fns->alloc || !init_fns->free) + return -EINVAL; + + fns_node = kzalloc(sizeof(*fns_node), GFP_KERNEL); + if (!fns_node) + return -ENOMEM; + + write_lock(&io_pgtable_init_fns_list_lock); + list_for_each_entry(iter, &io_pgtable_init_fns_list, list) + if (iter->fns->fmt == init_fns->fmt) { + ret = -EEXIST; + kfree(fns_node); + break; + } + + if (!ret) { + fns_node->fns = init_fns; + INIT_LIST_HEAD(&fns_node->list); + list_add_tail(&fns_node->list, &io_pgtable_init_fns_list); + } + write_unlock(&io_pgtable_init_fns_list_lock); + return ret; +} +EXPORT_SYMBOL_GPL(io_pgtable_ops_register); + +void io_pgtable_ops_unregister(struct io_pgtable_init_fns *init_fns) +{ + struct io_pgtable_init_fns_node *iter, *tmp; + + if (!init_fns) + return; + + write_lock(&io_pgtable_init_fns_list_lock); + list_for_each_entry_safe(iter, tmp, &io_pgtable_init_fns_list, list) + if (iter->fns == init_fns) { + list_del(&iter->list); + kfree(iter); + break; + } + write_unlock(&io_pgtable_init_fns_list_lock); +} +EXPORT_SYMBOL_GPL(io_pgtable_ops_unregister); diff --git a/include/linux/io-pgtable.h b/include/linux/io-pgtable.h index ea727eb..45b367ce 100644 --- a/include/linux/io-pgtable.h +++ b/include/linux/io-pgtable.h @@ -163,6 +163,38 @@ struct io_pgtable_ops { }; /** + * struct io_pgtable_init_fns - Alloc/free a set of page tables for a + * particular format. + * + * @fmt: The page table format. + * @alloc: Allocate a set of page tables described by cfg. + * @free: Free the page tables associated with iop. + */ +struct io_pgtable_init_fns { + enum io_pgtable_fmt fmt; + struct io_pgtable *(*alloc)(struct io_pgtable_cfg *cfg, void *cookie); + void (*free)(struct io_pgtable *iop); +}; + +/** + * io_pgtable_ops_register() - Register the page table routines for a page table + * format. + * + * @init_fns: The functions for allocating and freeing the page tables of + * a particular format. + */ +int io_pgtable_ops_register(struct io_pgtable_init_fns *init_fns); + +/** + * io_pgtable_ops_unregister() - Unregister the page table routines for a page + * table format. + * + * @init_fns: The functions for allocating and freeing the page tables of + * a particular format. + */ +void io_pgtable_ops_unregister(struct io_pgtable_init_fns *init_fns); + +/** * alloc_io_pgtable_ops() - Allocate a page table allocator for use by an IOMMU. * * @fmt: The page table format. @@ -233,23 +265,4 @@ io_pgtable_tlb_add_page(struct io_pgtable *iop, iop->cfg.tlb->tlb_add_page(gather, iova, granule, iop->cookie); } -/** - * struct io_pgtable_init_fns - Alloc/free a set of page tables for a - * particular format. - * - * @alloc: Allocate a set of page tables described by cfg. - * @free: Free the page tables associated with iop. - */ -struct io_pgtable_init_fns { - struct io_pgtable *(*alloc)(struct io_pgtable_cfg *cfg, void *cookie); - void (*free)(struct io_pgtable *iop); -}; - -extern struct io_pgtable_init_fns io_pgtable_arm_32_lpae_s1_init_fns; -extern struct io_pgtable_init_fns io_pgtable_arm_32_lpae_s2_init_fns; -extern struct io_pgtable_init_fns io_pgtable_arm_64_lpae_s1_init_fns; -extern struct io_pgtable_init_fns io_pgtable_arm_64_lpae_s2_init_fns; -extern struct io_pgtable_init_fns io_pgtable_arm_v7s_init_fns; -extern struct io_pgtable_init_fns io_pgtable_arm_mali_lpae_init_fns; - #endif /* __IO_PGTABLE_H */ From patchwork Tue Dec 22 00:44:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Isaac J. Manjarres" X-Patchwork-Id: 11985535 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=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 7A64DC43381 for ; Tue, 22 Dec 2020 00:46:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5076222B2B for ; Tue, 22 Dec 2020 00:46:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726261AbgLVApr (ORCPT ); Mon, 21 Dec 2020 19:45:47 -0500 Received: from so254-31.mailgun.net ([198.61.254.31]:13009 "EHLO so254-31.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726101AbgLVApq (ORCPT ); Mon, 21 Dec 2020 19:45:46 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1608597927; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=bYabydo/dXbRQkL5qXIuDQBWRKY+jGONTXRs3liUi6M=; b=UC+UFZFPVdVfuidL+tApd0uIR6GQ0B5mwXtIUp9UYwFQiE0O0Poxxsy1Lj7+XBBl3otqW8He VasQUbxJ7uvZo1MDy0YxgwX2HUDnP4xQTWRhHA0yrSgaU3FgHF2CsMbMEk+WHViZXrIhNrw+ KEcOQbWWMnRAExDyuReAK2ax0zM= X-Mailgun-Sending-Ip: 198.61.254.31 X-Mailgun-Sid: WyI1MzIzYiIsICJsaW51eC1hcm0tbXNtQHZnZXIua2VybmVsLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n07.prod.us-east-1.postgun.com with SMTP id 5fe14183b00c0d7ad406b461 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 22 Dec 2020 00:44:51 GMT Sender: isaacm=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id C7535C43466; Tue, 22 Dec 2020 00:44:50 +0000 (UTC) Received: from isaacm-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: isaacm) by smtp.codeaurora.org (Postfix) with ESMTPSA id 3F294C43464; Tue, 22 Dec 2020 00:44:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 3F294C43464 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=isaacm@codeaurora.org From: "Isaac J. Manjarres" To: iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: "Isaac J. Manjarres" , will@kernel.org, joro@8bytes.org, pdaly@codeaurora.org, pratikp@codeaurora.org, kernel-team@android.com, robin.murphy@arm.com Subject: [PATCH v2 2/7] iommu/io-pgtable: Add refcounting for io-pgtable format modules Date: Mon, 21 Dec 2020 16:44:31 -0800 Message-Id: <1608597876-32367-3-git-send-email-isaacm@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1608597876-32367-1-git-send-email-isaacm@codeaurora.org> References: <1608597876-32367-1-git-send-email-isaacm@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org In preparation for modularizing io-pgtable formats, add support for reference counting the io-pgtable format modules to ensure that the modules are not unloaded while they are in use. Signed-off-by: Isaac J. Manjarres --- drivers/iommu/io-pgtable-arm-v7s.c | 1 + drivers/iommu/io-pgtable-arm.c | 5 +++++ drivers/iommu/io-pgtable.c | 12 ++++++++++-- include/linux/io-pgtable.h | 2 ++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c index 89aad2f..a5cb755a 100644 --- a/drivers/iommu/io-pgtable-arm-v7s.c +++ b/drivers/iommu/io-pgtable-arm-v7s.c @@ -840,6 +840,7 @@ static struct io_pgtable_init_fns io_pgtable_arm_v7s_init_fns = { .fmt = ARM_V7S, .alloc = arm_v7s_alloc_pgtable, .free = arm_v7s_free_pgtable, + .owner = THIS_MODULE, }; #ifdef CONFIG_IOMMU_IO_PGTABLE_ARMV7S_SELFTEST diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c index ff0ea2f..e8b1e34 100644 --- a/drivers/iommu/io-pgtable-arm.c +++ b/drivers/iommu/io-pgtable-arm.c @@ -1049,26 +1049,31 @@ static struct io_pgtable_init_fns io_pgtable_arm_lpae_init_fns[] = { .fmt = ARM_32_LPAE_S1, .alloc = arm_32_lpae_alloc_pgtable_s1, .free = arm_lpae_free_pgtable, + .owner = THIS_MODULE, }, { .fmt = ARM_32_LPAE_S2, .alloc = arm_32_lpae_alloc_pgtable_s2, .free = arm_lpae_free_pgtable, + .owner = THIS_MODULE, }, { .fmt = ARM_64_LPAE_S1, .alloc = arm_64_lpae_alloc_pgtable_s1, .free = arm_lpae_free_pgtable, + .owner = THIS_MODULE, }, { .fmt = ARM_64_LPAE_S2, .alloc = arm_64_lpae_alloc_pgtable_s2, .free = arm_lpae_free_pgtable, + .owner = THIS_MODULE, }, { .fmt = ARM_MALI_LPAE, .alloc = arm_mali_lpae_alloc_pgtable, .free = arm_lpae_free_pgtable, + .owner = THIS_MODULE, }, }; diff --git a/drivers/iommu/io-pgtable.c b/drivers/iommu/io-pgtable.c index 2c6eb2e..cc83542 100644 --- a/drivers/iommu/io-pgtable.c +++ b/drivers/iommu/io-pgtable.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -52,9 +53,14 @@ struct io_pgtable_ops *alloc_io_pgtable_ops(enum io_pgtable_fmt fmt, if (!fns) return NULL; + if (!try_module_get(fns->owner)) + return NULL; + iop = fns->alloc(cfg, cookie); - if (!iop) + if (!iop) { + module_put(fns->owner); return NULL; + } iop->fmt = fmt; iop->cookie = cookie; @@ -79,8 +85,10 @@ void free_io_pgtable_ops(struct io_pgtable_ops *ops) iop = io_pgtable_ops_to_pgtable(ops); io_pgtable_tlb_flush_all(iop); fns = io_pgtable_get_init_fns(iop->fmt); - if (fns) + if (fns) { fns->free(iop); + module_put(fns->owner); + } } EXPORT_SYMBOL_GPL(free_io_pgtable_ops); diff --git a/include/linux/io-pgtable.h b/include/linux/io-pgtable.h index 45b367ce..a03b262 100644 --- a/include/linux/io-pgtable.h +++ b/include/linux/io-pgtable.h @@ -169,11 +169,13 @@ struct io_pgtable_ops { * @fmt: The page table format. * @alloc: Allocate a set of page tables described by cfg. * @free: Free the page tables associated with iop. + * @owner: Driver module providing these ops. */ struct io_pgtable_init_fns { enum io_pgtable_fmt fmt; struct io_pgtable *(*alloc)(struct io_pgtable_cfg *cfg, void *cookie); void (*free)(struct io_pgtable *iop); + struct module *owner; }; /** From patchwork Tue Dec 22 00:44:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Isaac J. Manjarres" X-Patchwork-Id: 11985531 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 6594FC433E6 for ; Tue, 22 Dec 2020 00:46:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2C7E322D49 for ; Tue, 22 Dec 2020 00:46:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725780AbgLVApp (ORCPT ); Mon, 21 Dec 2020 19:45:45 -0500 Received: from m43-15.mailgun.net ([69.72.43.15]:61932 "EHLO m43-15.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726101AbgLVApo (ORCPT ); Mon, 21 Dec 2020 19:45:44 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1608597920; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=jOAiW5O74HMIsivsb9aAjZ6ruz5TXLo2hBOc34WIMvo=; b=VsxpVFif3luu0mpjLZFIluyCFH8cpjVBSoQGk//n+tnrWBdfhY+4NVZKJmEffWqMx24OF+CG wnpRKTbCwlj3G4RVB7XGYcxmq6ykX5JGonFYM0+DS74h9vY7ytXWht9lbDNkW+bkW9LaFviZ r6Fx6qOPmj3sjfUQAGbWh1TbRE8= X-Mailgun-Sending-Ip: 69.72.43.15 X-Mailgun-Sid: WyI1MzIzYiIsICJsaW51eC1hcm0tbXNtQHZnZXIua2VybmVsLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n02.prod.us-east-1.postgun.com with SMTP id 5fe14184120d248bb5833ad5 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 22 Dec 2020 00:44:52 GMT Sender: isaacm=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 49238C433ED; Tue, 22 Dec 2020 00:44:52 +0000 (UTC) Received: from isaacm-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: isaacm) by smtp.codeaurora.org (Postfix) with ESMTPSA id 10A9AC43461; Tue, 22 Dec 2020 00:44:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 10A9AC43461 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=isaacm@codeaurora.org From: "Isaac J. Manjarres" To: iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: "Isaac J. Manjarres" , will@kernel.org, joro@8bytes.org, pdaly@codeaurora.org, pratikp@codeaurora.org, kernel-team@android.com, robin.murphy@arm.com Subject: [PATCH v2 3/7] iommu/arm-smmu: Add dependency on io-pgtable format modules Date: Mon, 21 Dec 2020 16:44:32 -0800 Message-Id: <1608597876-32367-4-git-send-email-isaacm@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1608597876-32367-1-git-send-email-isaacm@codeaurora.org> References: <1608597876-32367-1-git-send-email-isaacm@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The SMMU driver depends on the availability of the ARM LPAE and ARM V7S io-pgtable format code to work properly. In preparation for having the io-pgtable formats as modules, add a "pre" dependency with MODULE_SOFTDEP() to ensure that the io-pgtable format modules are loaded before loading the ARM SMMU driver module. Signed-off-by: Isaac J. Manjarres --- drivers/iommu/arm/arm-smmu/arm-smmu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c index d8c6bfd..a72649f 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c @@ -2351,3 +2351,4 @@ MODULE_DESCRIPTION("IOMMU API for ARM architected SMMU implementations"); MODULE_AUTHOR("Will Deacon "); MODULE_ALIAS("platform:arm-smmu"); MODULE_LICENSE("GPL v2"); +MODULE_SOFTDEP("pre: io-pgtable-arm io-pgtable-arm-v7s"); From patchwork Tue Dec 22 00:44:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Isaac J. Manjarres" X-Patchwork-Id: 11985545 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 B062FC433E6 for ; Tue, 22 Dec 2020 00:46:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 75BC022B43 for ; Tue, 22 Dec 2020 00:46:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726214AbgLVApt (ORCPT ); Mon, 21 Dec 2020 19:45:49 -0500 Received: from m43-15.mailgun.net ([69.72.43.15]:12478 "EHLO m43-15.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726314AbgLVAps (ORCPT ); Mon, 21 Dec 2020 19:45:48 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1608597924; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=0T+xlGHJP2wMYpgxmfrGKe+ecRzlLCw68x3Rb2S7kVs=; b=NBNe0bJoBhj1zbetB8IPLdGmevGHU460e23ELPiubQvNm4M9ybO9fwJbveCre1g4ctjbDkul 2VUqLPKhATMR2Xh+nMUm3IFm2o23ra8NQYIBsUa3tAmldEoKrjVL4I3zE6LsDu5StnicfRt1 HBkQtdf1vBKm38mWdmEtGR5rHT4= X-Mailgun-Sending-Ip: 69.72.43.15 X-Mailgun-Sid: WyI1MzIzYiIsICJsaW51eC1hcm0tbXNtQHZnZXIua2VybmVsLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n09.prod.us-east-1.postgun.com with SMTP id 5fe14186e61d77c9713c6f9a (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 22 Dec 2020 00:44:54 GMT Sender: isaacm=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id BFD41C43464; Tue, 22 Dec 2020 00:44:53 +0000 (UTC) Received: from isaacm-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: isaacm) by smtp.codeaurora.org (Postfix) with ESMTPSA id 76629C43463; Tue, 22 Dec 2020 00:44:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 76629C43463 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=isaacm@codeaurora.org From: "Isaac J. Manjarres" To: iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: "Isaac J. Manjarres" , will@kernel.org, joro@8bytes.org, pdaly@codeaurora.org, pratikp@codeaurora.org, kernel-team@android.com, robin.murphy@arm.com Subject: [PATCH v2 4/7] iommu/arm-smmu-v3: Add dependency on io-pgtable-arm format module Date: Mon, 21 Dec 2020 16:44:33 -0800 Message-Id: <1608597876-32367-5-git-send-email-isaacm@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1608597876-32367-1-git-send-email-isaacm@codeaurora.org> References: <1608597876-32367-1-git-send-email-isaacm@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The SMMUv3 driver depends on the availability of the ARM LPAE io-pgtable format code to work properly. In preparation for having the io-pgtable formats as modules, add a "pre" dependency with MODULE_SOFTDEP() to ensure that the io-pgtable-arm format module is loaded before loading the ARM SMMUv3 driver module. Signed-off-by: Isaac J. Manjarres --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c index 8ca7415..c498ac8 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -3650,3 +3650,4 @@ MODULE_DESCRIPTION("IOMMU API for ARM architected SMMUv3 implementations"); MODULE_AUTHOR("Will Deacon "); MODULE_ALIAS("platform:arm-smmu-v3"); MODULE_LICENSE("GPL v2"); +MODULE_SOFTDEP("pre: io-pgtable-arm"); From patchwork Tue Dec 22 00:44:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Isaac J. Manjarres" X-Patchwork-Id: 11985543 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 75289C433DB for ; Tue, 22 Dec 2020 00:46:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 440E522AAA for ; Tue, 22 Dec 2020 00:46:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726101AbgLVApr (ORCPT ); Mon, 21 Dec 2020 19:45:47 -0500 Received: from m43-15.mailgun.net ([69.72.43.15]:23253 "EHLO m43-15.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726242AbgLVApr (ORCPT ); Mon, 21 Dec 2020 19:45:47 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1608597928; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=Z0ZowGR4zaHQgcx0nXoZzCUPPTdU48hf87YrqUTmLnY=; b=hfkaazQQFnNgN4Ltx3Vt9sj7N0RDLog1ZJ5dUy9ibplWkA/M6WNMV4D7tEhkvZW5zLv82gNL y40N7CjChQXPR9VcUEr7SDYsxifpgVxkNN1N0/uxKDQdHdV5wXAj7iThWTRa5XuWrIh7tlhe bRqyvkCGrYkoWSBIax+Qmp1O56I= X-Mailgun-Sending-Ip: 69.72.43.15 X-Mailgun-Sid: WyI1MzIzYiIsICJsaW51eC1hcm0tbXNtQHZnZXIua2VybmVsLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n02.prod.us-west-2.postgun.com with SMTP id 5fe141876d2f42c6668cbad1 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 22 Dec 2020 00:44:55 GMT Sender: isaacm=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 0BF16C43465; Tue, 22 Dec 2020 00:44:55 +0000 (UTC) Received: from isaacm-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: isaacm) by smtp.codeaurora.org (Postfix) with ESMTPSA id DE3D8C43467; Tue, 22 Dec 2020 00:44:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org DE3D8C43467 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=isaacm@codeaurora.org From: "Isaac J. Manjarres" To: iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: "Isaac J. Manjarres" , will@kernel.org, joro@8bytes.org, pdaly@codeaurora.org, pratikp@codeaurora.org, kernel-team@android.com, robin.murphy@arm.com Subject: [PATCH v2 5/7] drm/msm: Add dependency on io-pgtable-arm format module Date: Mon, 21 Dec 2020 16:44:34 -0800 Message-Id: <1608597876-32367-6-git-send-email-isaacm@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1608597876-32367-1-git-send-email-isaacm@codeaurora.org> References: <1608597876-32367-1-git-send-email-isaacm@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The MSM DRM driver depends on the availability of the ARM LPAE io-pgtable format code to work properly. In preparation for having the io-pgtable formats as modules, add a "pre" dependency with MODULE_SOFTDEP() to ensure that the io-pgtable-arm format module is loaded before loading the MSM DRM driver module. Signed-off-by: Isaac J. Manjarres --- drivers/gpu/drm/msm/msm_drv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 535a026..8be3506 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -1369,3 +1369,4 @@ module_exit(msm_drm_unregister); MODULE_AUTHOR("Rob Clark X-Patchwork-Id: 11985539 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 7738CC43333 for ; Tue, 22 Dec 2020 00:46:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 55C7B22B2D for ; Tue, 22 Dec 2020 00:46:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726627AbgLVApz (ORCPT ); Mon, 21 Dec 2020 19:45:55 -0500 Received: from m43-15.mailgun.net ([69.72.43.15]:58078 "EHLO m43-15.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726540AbgLVApy (ORCPT ); Mon, 21 Dec 2020 19:45:54 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1608597930; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=uRl55kgW9XKzL1b1lRBQjM6Pzb0e5uOth9CmcyHiqfY=; b=kFwtXv1sstzcMYVTiAkUuaLbPVmcdS1iFa20+1WMCoxY38ptkH2p1Ww9n6kj8ZfYbUqaqeL7 ouTeL3CS9lJ0YrDxw1NU0aG7P7o+udzGMwnAM1vIGNh+a2FMwBcUZF6t2JxDvv3MwxdGwems 0NaLA8bh2W5bz8BEVB+B6ZOuqws= X-Mailgun-Sending-Ip: 69.72.43.15 X-Mailgun-Sid: WyI1MzIzYiIsICJsaW51eC1hcm0tbXNtQHZnZXIua2VybmVsLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n06.prod.us-east-1.postgun.com with SMTP id 5fe14189b00c0d7ad406c3e6 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 22 Dec 2020 00:44:57 GMT Sender: isaacm=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id E2A83C43468; Tue, 22 Dec 2020 00:44:56 +0000 (UTC) Received: from isaacm-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: isaacm) by smtp.codeaurora.org (Postfix) with ESMTPSA id 900D2C43463; Tue, 22 Dec 2020 00:44:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 900D2C43463 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=isaacm@codeaurora.org From: "Isaac J. Manjarres" To: iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: "Isaac J. Manjarres" , will@kernel.org, joro@8bytes.org, pdaly@codeaurora.org, pratikp@codeaurora.org, kernel-team@android.com, robin.murphy@arm.com Subject: [PATCH v2 6/7] drm/panfrost: Add dependency on io-pgtable-arm format module Date: Mon, 21 Dec 2020 16:44:35 -0800 Message-Id: <1608597876-32367-7-git-send-email-isaacm@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1608597876-32367-1-git-send-email-isaacm@codeaurora.org> References: <1608597876-32367-1-git-send-email-isaacm@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The Panfrost DRM driver depends on the availability of the ARM LPAE io-pgtable format code to work properly. In preparation for having the io-pgtable formats as modules, add a "pre" dependency with MODULE_SOFTDEP() to ensure that the io-pgtable-arm format module is loaded before loading the Panfrost DRM driver module. Signed-off-by: Isaac J. Manjarres --- drivers/gpu/drm/panfrost/panfrost_drv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c index 83a461b..7294622 100644 --- a/drivers/gpu/drm/panfrost/panfrost_drv.c +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c @@ -704,3 +704,4 @@ module_platform_driver(panfrost_driver); MODULE_AUTHOR("Panfrost Project Developers"); MODULE_DESCRIPTION("Panfrost DRM Driver"); MODULE_LICENSE("GPL v2"); +MODULE_SOFTDEP("pre: io-pgtable-arm"); From patchwork Tue Dec 22 00:44:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Isaac J. Manjarres" X-Patchwork-Id: 11985537 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 5844BC432C3 for ; Tue, 22 Dec 2020 00:46:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 41C4122B2C for ; Tue, 22 Dec 2020 00:46:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726662AbgLVAp4 (ORCPT ); Mon, 21 Dec 2020 19:45:56 -0500 Received: from so254-31.mailgun.net ([198.61.254.31]:34237 "EHLO so254-31.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726625AbgLVApz (ORCPT ); Mon, 21 Dec 2020 19:45:55 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1608597932; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=1bjQCUDo6TkclQdX/S/yzQuV1vY9gcmjTKp7aSEvBh8=; b=JIfRU8uxwT08GjbnGvZ1eJcsCsIkZwQndy0FW5oUe/MDSHyNxSRWWr1sezOi5b07bKsKwRVX MN6/rbdMSj5w2lm1rqrUJ+0VAX7Oo2jZgSbhoEF5eWiRBJWU3J0lBqNk0CixLFgrRBOq0KOu VzfylfA4oEvc0+nNeiS22L1ZhH0= X-Mailgun-Sending-Ip: 198.61.254.31 X-Mailgun-Sid: WyI1MzIzYiIsICJsaW51eC1hcm0tbXNtQHZnZXIua2VybmVsLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n01.prod.us-west-2.postgun.com with SMTP id 5fe1418adb8e07fa6c477cc7 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 22 Dec 2020 00:44:58 GMT Sender: isaacm=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 28BAEC43462; Tue, 22 Dec 2020 00:44:58 +0000 (UTC) Received: from isaacm-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: isaacm) by smtp.codeaurora.org (Postfix) with ESMTPSA id EBEE0C4346B; Tue, 22 Dec 2020 00:44:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org EBEE0C4346B Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=isaacm@codeaurora.org From: "Isaac J. Manjarres" To: iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: "Isaac J. Manjarres" , will@kernel.org, joro@8bytes.org, pdaly@codeaurora.org, pratikp@codeaurora.org, kernel-team@android.com, robin.murphy@arm.com Subject: [PATCH v2 7/7] iommu/io-pgtable-arm: Allow building modular io-pgtable fmts Date: Mon, 21 Dec 2020 16:44:36 -0800 Message-Id: <1608597876-32367-8-git-send-email-isaacm@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1608597876-32367-1-git-send-email-isaacm@codeaurora.org> References: <1608597876-32367-1-git-send-email-isaacm@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Now that everything is in place for modular io-pgtable formats, allow the ARM LPAE and ARMV7S io-pgtable formats to be built as modules. Signed-off-by: Isaac J. Manjarres --- drivers/iommu/Kconfig | 4 ++-- drivers/iommu/io-pgtable-arm-v7s.c | 2 ++ drivers/iommu/io-pgtable-arm.c | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index 192ef8f..7e4f44f 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig @@ -30,7 +30,7 @@ config IOMMU_IO_PGTABLE bool config IOMMU_IO_PGTABLE_LPAE - bool "ARMv7/v8 Long Descriptor Format" + tristate "ARMv7/v8 Long Descriptor Format" select IOMMU_IO_PGTABLE depends on ARM || ARM64 || (COMPILE_TEST && !GENERIC_ATOMIC64) help @@ -49,7 +49,7 @@ config IOMMU_IO_PGTABLE_LPAE_SELFTEST If unsure, say N here. config IOMMU_IO_PGTABLE_ARMV7S - bool "ARMv7/v8 Short Descriptor Format" + tristate "ARMv7/v8 Short Descriptor Format" select IOMMU_IO_PGTABLE depends on ARM || ARM64 || COMPILE_TEST help diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c index a5cb755a..9d9f08f 100644 --- a/drivers/iommu/io-pgtable-arm-v7s.c +++ b/drivers/iommu/io-pgtable-arm-v7s.c @@ -1015,3 +1015,5 @@ static void __exit arm_v7s_exit(void) io_pgtable_ops_unregister(&io_pgtable_arm_v7s_init_fns); } module_exit(arm_v7s_exit); + +MODULE_LICENSE("GPL v2"); diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c index e8b1e34..e0de4ad 100644 --- a/drivers/iommu/io-pgtable-arm.c +++ b/drivers/iommu/io-pgtable-arm.c @@ -1299,3 +1299,5 @@ static void __exit arm_lpae_exit(void) io_pgtable_ops_unregister(&io_pgtable_arm_lpae_init_fns[i]); } module_exit(arm_lpae_exit); + +MODULE_LICENSE("GPL v2");