From patchwork Thu Dec 10 16:57:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Singh X-Patchwork-Id: 11965641 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, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 3504AC433FE for ; Thu, 10 Dec 2020 17:01:14 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 DCDDE207A2 for ; Thu, 10 Dec 2020 17:01:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DCDDE207A2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.49605.87751 (Exim 4.92) (envelope-from ) id 1knPJT-0007a9-4T; Thu, 10 Dec 2020 17:01:07 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 49605.87751; Thu, 10 Dec 2020 17:01:07 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1knPJT-0007Zz-0p; Thu, 10 Dec 2020 17:01:07 +0000 Received: by outflank-mailman (input) for mailman id 49605; Thu, 10 Dec 2020 17:01:05 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1knPJR-0007YB-7R for xen-devel@lists.xenproject.org; Thu, 10 Dec 2020 17:01:05 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 416ef82b-5042-482d-978e-15753698a07b; Thu, 10 Dec 2020 17:01:04 +0000 (UTC) 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 EA64D30E; Thu, 10 Dec 2020 09:01:03 -0800 (PST) Received: from scm-wfh-server-rahsin01.stack04.eu02.mi.arm.com (unknown [10.58.246.76]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0FBCE3F66B; Thu, 10 Dec 2020 09:01:02 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 416ef82b-5042-482d-978e-15753698a07b From: Rahul Singh To: xen-devel@lists.xenproject.org Cc: bertrand.marquis@arm.com, rahul.singh@arm.com, Stefano Stabellini , Julien Grall , Volodymyr Babchuk Subject: [PATCH v3 8/8] xen/arm: smmuv3: Remove linux compatibility functions. Date: Thu, 10 Dec 2020 16:57:06 +0000 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Replace all Linux compatible device tree handling function with the XEN functions. Replace all Linux ktime function with the XEN time functions. Signed-off-by: Rahul Singh Reviewed-by: Stefano Stabellini Reviewed-by: Bertrand Marquis --- Changes in v3: - This patch is introduce in this version. --- xen/drivers/passthrough/arm/smmu-v3.c | 32 +++++++-------------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthrough/arm/smmu-v3.c index 65b3db94ad..c19c56ebc8 100644 --- a/xen/drivers/passthrough/arm/smmu-v3.c +++ b/xen/drivers/passthrough/arm/smmu-v3.c @@ -101,22 +101,6 @@ typedef unsigned int gfp_t; #define GFP_KERNEL 0 -/* Alias to Xen device tree helpers */ -#define device_node dt_device_node -#define of_phandle_args dt_phandle_args -#define of_device_id dt_device_match -#define of_match_node dt_match_node -#define of_property_read_u32(np, pname, out) \ - (!dt_property_read_u32(np, pname, out)) -#define of_property_read_bool dt_property_read_bool -#define of_parse_phandle_with_args dt_parse_phandle_with_args - -/* Alias to Xen time functions */ -#define ktime_t s_time_t -#define ktime_get() (NOW()) -#define ktime_add_us(t, i) (t + MICROSECS(i)) -#define ktime_compare(t, i) (t > (i)) - /* Alias to Xen allocation helpers */ #define kzalloc(size, flags) _xzalloc(size, sizeof(void *)) #define kfree xfree @@ -922,7 +906,7 @@ static void parse_driver_options(struct arm_smmu_device *smmu) int i = 0; do { - if (of_property_read_bool(smmu->dev->of_node, + if (dt_property_read_bool(smmu->dev->of_node, arm_smmu_options[i].prop)) { smmu->options |= arm_smmu_options[i].opt; dev_notice(smmu->dev, "option %s\n", @@ -994,17 +978,17 @@ static void queue_inc_prod(struct arm_smmu_ll_queue *q) */ static int queue_poll_cons(struct arm_smmu_queue *q, bool sync, bool wfe) { - ktime_t timeout; + s_time_t timeout; unsigned int delay = 1, spin_cnt = 0; /* Wait longer if it's a CMD_SYNC */ - timeout = ktime_add_us(ktime_get(), sync ? + timeout = NOW() + MICROSECS(sync ? ARM_SMMU_CMDQ_SYNC_TIMEOUT_US : ARM_SMMU_POLL_TIMEOUT_US); while (queue_sync_cons_in(q), (sync ? !queue_empty(&q->llq) : queue_full(&q->llq))) { - if (ktime_compare(ktime_get(), timeout) > 0) + if ((NOW() > timeout) > 0) return -ETIMEDOUT; if (wfe) { @@ -1232,13 +1216,13 @@ static void arm_smmu_cmdq_issue_cmd(struct arm_smmu_device *smmu, */ static int __arm_smmu_sync_poll_msi(struct arm_smmu_device *smmu, u32 sync_idx) { - ktime_t timeout; + s_time_t timeout; u32 val; - timeout = ktime_add_us(ktime_get(), ARM_SMMU_CMDQ_SYNC_TIMEOUT_US); + timeout = NOW() + MICROSECS(ARM_SMMU_CMDQ_SYNC_TIMEOUT_US); val = smp_cond_load_acquire(&smmu->sync_count, (int)(VAL - sync_idx) >= 0 || - !ktime_before(ktime_get(), timeout)); + !(NOW() < timeout)); return (int)(val - sync_idx) < 0 ? -ETIMEDOUT : 0; } @@ -2969,7 +2953,7 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev, u32 cells; int ret = -EINVAL; - if (of_property_read_u32(dev->of_node, "#iommu-cells", &cells)) + if (!dt_property_read_u32(dev->of_node, "#iommu-cells", &cells)) dev_err(dev, "missing #iommu-cells property\n"); else if (cells != 1) dev_err(dev, "invalid #iommu-cells value (%d)\n", cells);