Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7641490imu; Tue, 22 Jan 2019 09:08:58 -0800 (PST) X-Google-Smtp-Source: ALg8bN5sJDaNh0PhemXWEWHnizLkTnNDNGLgy1tgM7Z4xw2fEJSeqhTT0RxCwHpwFzmYafH8FQSJ X-Received: by 2002:a62:710a:: with SMTP id m10mr34036890pfc.69.1548176938550; Tue, 22 Jan 2019 09:08:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548176938; cv=none; d=google.com; s=arc-20160816; b=E9dHN6W0fzHMFVAHkcDzlNy8ecJOBgt9XBYLMMZ9S4weXc4KZ473UGC9Tp9Al3tX8w kPHNT9S8E4yxF+6snnOfAON5xvouEAiFJBBUSau8NRKFq/eXRo4f2qjZuVP7k+5/l03N Z6BYYtsr8RLHCis2AQtPTHCU+KTDVjLogKinN14jx4c+UX/D0FEA5g1BBjsNSbdmwvNb uWX9o/XWd9NdbRelJ/hUVKPE3Xar16sd+zCiu65jQCvUZloVFuiw3+61lM+kQllubs24 4K0NWyK4YifLse7dU7zepueyNuq7QF7PBc1PWyKW3FFB0b/kcGq6xpvoR0DTdG7O0k3C HKbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dmarc-filter:dkim-signature :dkim-signature; bh=tQYkYYnIEHz8vyu79hmqmVHPjRM52WGOLKblOeYma+k=; b=JTIPND6Yy7wgqiSofYWT1/ejHvTlYS07fXp4kpf3CbWa3vbgvx94gsvgn+Fvu0cneY 1KzyIGGF8OBdrTyxp4L/msZy+jq/Q8tLMkwRsZmgX+op2XACx93EuJ/VnkfpaEHyq9rp yp/81UwdHwGBT9+OIGmS90qGs06L/m09GKs8hJgsPLUsdk4yYlFy1EN9yn1wjelLw8I0 a1ZvSaAgxkiBdcZEbnj3mrQwbdv/OaNXyI4OemqKPXQabODcuWQFwVYAxjKYXGGTWNvb N/hdWDUEkGFtu5X13/GIAEfx1TJ14fMuq4/Eycia7aSklBJKmXmMR9QAWgnITJ8Lt+Y6 V4Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=SGgWtVDy; dkim=pass header.i=@codeaurora.org header.s=default header.b=D1LSPVCA; 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 g9si16149767pfd.86.2019.01.22.09.08.42; Tue, 22 Jan 2019 09:08:58 -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=SGgWtVDy; dkim=pass header.i=@codeaurora.org header.s=default header.b=D1LSPVCA; 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 S1729460AbfAVRGx (ORCPT + 99 others); Tue, 22 Jan 2019 12:06:53 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:40724 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729400AbfAVRGw (ORCPT ); Tue, 22 Jan 2019 12:06:52 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 3F44C6058E; Tue, 22 Jan 2019 17:06:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1548176811; bh=m9EYD1U6kVRMiotzE6lgXblp3Ir5lCrzPsFy85sYUsQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=SGgWtVDyjJ4EklYW3kC15qlOJD6j8jD9WcVAduVMk42aO6M90GlBog9704vScHjA5 fU1a92STEon9cEi4tMkJOGr1JAjvLh1E7YZFI3QZbfTmYiqoAYlqEJxt5eYAUQhIqf aNAYp0FWk7S4W3TMCggf35qd2Mjzmco2pUH7q8NY= 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 mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vivek.gautam@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 86C9D6079C; Tue, 22 Jan 2019 17:06:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1548176809; bh=m9EYD1U6kVRMiotzE6lgXblp3Ir5lCrzPsFy85sYUsQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=D1LSPVCAO2cvp07wHRLPLe7fJAoPsd9HmH4gPrbSQGwhfph8Bfvsqw6WQ1QguCzhk FWIYCFzmj00OivrGYyo+8T9cS9LKs3DrHzEHzfdWLkcVVjHsv9hU1ytbPiSnHdbUbO YIOWmRHXHlofaRgD6WSMebRfGZ81pmoYNxba6TnU= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 86C9D6079C 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 Received: by mail-ed1-f53.google.com with SMTP id d39so19857766edb.12; Tue, 22 Jan 2019 09:06:49 -0800 (PST) X-Gm-Message-State: AJcUukc/xcUrGJICePOKvEUMF/4Wzk2gLdnUF/d11TnpKIrk3E/lrU19 5i7j3hKnDiI3zBUm92Qmw8zkJwCjq6Pp3GhmicU= X-Received: by 2002:aa7:c0d0:: with SMTP id j16mr31111179edp.173.1548176808160; Tue, 22 Jan 2019 09:06:48 -0800 (PST) MIME-Version: 1.0 References: <20190121055335.15430-1-vivek.gautam@codeaurora.org> <20190121055335.15430-2-vivek.gautam@codeaurora.org> In-Reply-To: From: Vivek Gautam Date: Tue, 22 Jan 2019 22:36:36 +0530 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/3] iommu/arm-smmu: Move to bitmap for arm_smmu_domain atrributes To: Robin Murphy Cc: Will Deacon , "list@263.net:IOMMU DRIVERS , Joerg Roedel ," , "list@263.net:IOMMU DRIVERS , Joerg Roedel ," , pdaly@codeaurora.org, linux-arm-msm , open list , pratikp@codeaurora.org, Linux ARM Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 21, 2019 at 7:23 PM Robin Murphy wrote: > > On 21/01/2019 05:53, Vivek Gautam wrote: > > 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; > > But what if *data == 0? Right, a check for data here also similar to what we are doing for QCOM_SYS_CACHE [1]. [1] https://lore.kernel.org/patchwork/patch/1033796/ Regards Vivek > > Robin. > > > break; > > default: > > ret = -ENODEV; > > > _______________________________________________ > iommu mailing list > iommu@lists.linux-foundation.org > https://lists.linuxfoundation.org/mailman/listinfo/iommu -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation