From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DCD2DC61DA4 for ; Wed, 15 Mar 2023 08:38:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jFFcvw37v6E1HfnzFgPSaPLzZUGE/2s80yQ2KxH6m5s=; b=IfmizBhUR4A8K1 FYq4I+wm4qRs5UZqIw0+fXUnRKvyTfYPLFUmRDMpDeLJQiRlO364wlyFpLDAc39KGW17qYVgR69ov xGSlCQPtRDfXkPQTC7u6cCUu1uH5tmrDZJ7EAPMQdGqI2H08RTl2gYMMcfRrkArhgZ4Ac44hTzWpp QkYSt0XfOJxALNvdoAnhcvOs4gBmG7uPo9hLkrtkva9BBY3VLOjdC0VUqhYp6YNy9ZgVNtoVdkAJ8 U9qH1bkaOC6A9J9brGR9WQYMvhWG8JOcedoCb9SW6YZ+qQTMjPahl4M5fM7s601LYiJ6tJJaLr5Jo DPbHhN9uJvWkX2F3t3dg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pcMdj-00Cnp8-35; Wed, 15 Mar 2023 08:37:43 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pcMdf-00CnoA-1Z for linux-arm-kernel@lists.infradead.org; Wed, 15 Mar 2023 08:37:41 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2D1E4B81D90; Wed, 15 Mar 2023 08:37:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7222EC433D2; Wed, 15 Mar 2023 08:37:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678869456; bh=4pZA2ch6tMZtoAsHJihB4/kMMVTpVXQpbWpqS2cZx94=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dckC4qvEYe3d7uEI7SeBTortKL1SkyXl6Szt0jwi0qyH5aPBKI4flbehgZDlSWSPf FC8UKmXkvaQ27GSdofKGrsy3goJX4sa6FnC63Om4YlKwOB9nCpuIECrPodW9Gla4L8 txYeO4rufnFt9jb/Bfo4FMcBf6QVxu3iiRsQjRDYJir67sLi0uzm5t1vOFyNt5pnX8 MHJCU+jg63wkFgc/+MePU9u2ekkwciplsw1VZHsCYacT2JCioJd/hYXdTHpJyIDw/p +5li/y8sNHWl5beB4OCvYcepMuybRmwz8E0OZ7HByoGPoKa7T6pqqh7dwZ4JZanInv ujEuV0+1nr0Kw== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pcMeg-0004rI-98; Wed, 15 Mar 2023 09:38:42 +0100 Date: Wed, 15 Mar 2023 09:38:42 +0100 From: Johan Hovold To: Manivannan Sadhasivam Cc: will@kernel.org, joro@8bytes.org, robin.murphy@arm.com, andersson@kernel.org, johan+linaro@kernel.org, steev@kali.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] iommu/arm-smmu-qcom: Rework the logic finding the bypass quirk Message-ID: References: <20230314184659.176473-1-manivannan.sadhasivam@linaro.org> <20230315075958.GC25575@thinkpad> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230315075958.GC25575@thinkpad> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230315_013739_828482_84A99FCE X-CRM114-Status: GOOD ( 26.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Mar 15, 2023 at 01:29:58PM +0530, Manivannan Sadhasivam wrote: > On Wed, Mar 15, 2023 at 08:37:32AM +0100, Johan Hovold wrote: > > > +static int qcom_smmu_cfg_probe(struct arm_smmu_device *smmu) > > > +{ > > > + u32 smr; > > > + int i; > > > + > > > + /* > > > + * Limit the number of stream matching groups to 128 as the ARM SMMU architecture > > > + * specification defines NUMSMRG (Number of Stream Mapping Register Groups) in the > > > + * range of 0-127, but some Qcom platforms emulate more stream mapping groups. And > > > + * those groups don't exhibit the same behavior as the architecture supported ones. > > > + */ > > > > Please fix your editor so that it wraps lines at 80 columns, which is > > still the preferred (soft) limit. > > > > If exceeding 80 columns end up making the comment more readable (fewer lines), > then why should we limit ourselves? Exceeding 80 column for comments does generally not improve readability. That part of the coding standard has do to with not adding excessive line breaks to *code*, where it can sometimes impact readability. > > > + if (smmu->num_mapping_groups > 128) { > > > + dev_warn(smmu->dev, "\tLimiting the stream matching groups to 128\n"); > > > > dev_notice() should do since there's nothing a user can do about this. > > > > Ok. > > > > + smmu->num_mapping_groups = 128; > > > + } > > > > So this hunk is really all that is needed to make the current quirk > > detection work on sc8280xp. Why not simply stick with the current logic > > and use the last group until there is a need for anything more? > > > > No! What if the bootloader had set up mapping for 128 groups? In that case > we'll overwrite the last group. It is still required to find the valid group > and use it for quirk detection. If no group is available, we'll skip it. Yes, but that's also entirely hypothetical (and could perhaps also be handled by adding a warning for now). If you want to rework the quirk handling for this you should at least do so in a separate patch as it is arguably a separate change from fixing the current quirk detection for newer SoCs by capping the number of groups (a minimal fix that could be backported). Johan _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel