Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5912338imu; Sun, 20 Jan 2019 23:16:13 -0800 (PST) X-Google-Smtp-Source: ALg8bN75VPDRg4Vpuaz2Z99rd3YDeLh2QQq85ux8wJiBjSXwWMs7HdoWbtDDJo/mMIjooD6lUkIK X-Received: by 2002:a63:6006:: with SMTP id u6mr27331656pgb.176.1548054973332; Sun, 20 Jan 2019 23:16:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548054973; cv=none; d=google.com; s=arc-20160816; b=YRtnzDoipmP0SRDrpcBxZ2wtMvfAZ/dClI2o7xMlke7axINT9x0PUY2Ysjo8YyvWJH yRFm6MluDL3fB4akvDNXpDNsYofxLjtBmHX+5vEgWlIYVonUsW2lJJjaM94qM+MF+ROK n2KtQDKdQ8xTnQ8P2TwoxisEbQD/zvQ/L8ikuUySHqUxe8QXsygllzFnZcYTUfl6PSUf r+anmI40JBo+zHK+49mQ8sKNnPCdr0SKPpoC0L1vKnCeyqCNXq4h7MzXeAOJ8cEPSUXr r2jlOARWBkCm8uLA3Lptt1pRCesP0508gRmtb9D49Qdf/bBy7NRx3VKXLT8cnI6o+Cgh xmNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature; bh=Zq/KhBNIJV7eSfBcUeqTFVJUiUhWpO3cmcqcVrC5VRg=; b=V6HR920OgB3GmTTtOcYou6WEYVzpxiAGqUMYbZRjgelcvJgpNcrtUTuT1UrsBd43bi 48+VQtp5LAPLRcjocK+9DhBnIKObZWJcgd8yt1XMS4lj4xkgXTB8Bu+PdkDwEXzTn+WG h4XcXjitiiU1kR+rWNVg8Q5aayqClLVRW88Y0RkmrCauhbtSSEOLf6cqh7TbGdLNdubO +BFx+1xShw/1zLWC4rjjPOmC1Yi7c/s3wB3G2jkcSo6mDMs9nbzZrrGuVTurI11v93EH PygO59i+CRAvrzgeUoQuByMId/wcaWukl+hMnZ7sD+Zcd7hrvHznjw4XFDe48qqHdI1Z 0b+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b="Xs/4UlIj"; dkim=pass header.i=@codeaurora.org header.s=default header.b=A7n7B4m5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b3si11678915pgh.496.2019.01.20.23.15.57; Sun, 20 Jan 2019 23:16:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b="Xs/4UlIj"; dkim=pass header.i=@codeaurora.org header.s=default header.b=A7n7B4m5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728275AbfAUHOC (ORCPT + 99 others); Mon, 21 Jan 2019 02:14:02 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:43272 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727920AbfAUHNE (ORCPT ); Mon, 21 Jan 2019 02:13:04 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 78F47608BA; Mon, 21 Jan 2019 05:53:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1548050032; bh=4mDXwAKHFSc10cR+k82iN/G4anm4O+nQXiSjDjukJ9E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xs/4UlIjpWtE/38obAbEUQYGPqNjN4R+mOKk8kr4h1S+TK+0PrcyAIH1XwB5yXp1C Wi9juo6Tw4hd/VnQyB/eWlyeehoC3xWxB8xB4bK5JV8AP4gPMWhFx2O33iL2d4d+O2 twpFBOVeUrso7f/BtjYjkQHJ5kvHqHxTMLJbKvyA= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from blr-ubuntu-41.ap.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vivek.gautam@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 441566020B; Mon, 21 Jan 2019 05:53:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1548050031; bh=4mDXwAKHFSc10cR+k82iN/G4anm4O+nQXiSjDjukJ9E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A7n7B4m5rAc5QToi9qamk/lPuXijQkDh0YIFRtv+Ku3l12hOlgK9FHgAbLFMywE3x w/aMMEhshHhzRNXFWosXrtLWrr3YRVdZhPNhoLB1hkgbtJrjAhFzAm+d4e4hU206lQ Cl2KzUIKR8kagaBcNuWUc/Mqr1wNr9ecdXBx8AQI= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 441566020B Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=vivek.gautam@codeaurora.org From: Vivek Gautam To: will.deacon@arm.com, robin.murphy@arm.com, joro@8bytes.org, iommu@lists.linux-foundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, tfiga@chromium.org, pratikp@codeaurora.org, pdaly@codeaurora.org, jcrouse@codeaurora.org, Vivek Gautam Subject: [PATCH 1/3] iommu/arm-smmu: Move to bitmap for arm_smmu_domain atrributes Date: Mon, 21 Jan 2019 11:23:33 +0530 Message-Id: <20190121055335.15430-2-vivek.gautam@codeaurora.org> X-Mailer: git-send-email 2.16.1.72.g5be1f00a9a70 In-Reply-To: <20190121055335.15430-1-vivek.gautam@codeaurora.org> References: <20190121055335.15430-1-vivek.gautam@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A number of arm_smmu_domain's attributes can be assigned based on the iommu domains's attributes. These local attributes better be managed by a bitmap. So remove boolean flags and move to a 32-bit bitmap, and enable each bits separtely. Signed-off-by: Vivek Gautam --- drivers/iommu/arm-smmu.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 7ebbcf1b2eb3..52b300dfc096 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -257,10 +257,11 @@ struct arm_smmu_domain { const struct iommu_gather_ops *tlb_ops; struct arm_smmu_cfg cfg; enum arm_smmu_domain_stage stage; - bool non_strict; struct mutex init_mutex; /* Protects smmu pointer */ spinlock_t cb_lock; /* Serialises ATS1* ops and TLB syncs */ struct iommu_domain domain; +#define ARM_SMMU_DOMAIN_ATTR_NON_STRICT BIT(0) + unsigned int attr; }; struct arm_smmu_option_prop { @@ -901,7 +902,7 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain, if (smmu->features & ARM_SMMU_FEAT_COHERENT_WALK) pgtbl_cfg.quirks = IO_PGTABLE_QUIRK_NO_DMA; - if (smmu_domain->non_strict) + if (smmu_domain->attr & ARM_SMMU_DOMAIN_ATTR_NON_STRICT) pgtbl_cfg.quirks |= IO_PGTABLE_QUIRK_NON_STRICT; /* Non coherent page table mappings only for Stage-1 */ @@ -1598,7 +1599,8 @@ static int arm_smmu_domain_get_attr(struct iommu_domain *domain, case IOMMU_DOMAIN_DMA: switch (attr) { case DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE: - *(int *)data = smmu_domain->non_strict; + *(int *)data = !!(smmu_domain->attr & + ARM_SMMU_DOMAIN_ATTR_NON_STRICT); return 0; default: return -ENODEV; @@ -1638,7 +1640,7 @@ static int arm_smmu_domain_set_attr(struct iommu_domain *domain, case IOMMU_DOMAIN_DMA: switch (attr) { case DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE: - smmu_domain->non_strict = *(int *)data; + smmu_domain->attr |= ARM_SMMU_DOMAIN_ATTR_NON_STRICT; break; default: ret = -ENODEV; -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation