Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2126715rdh; Tue, 26 Sep 2023 13:20:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGq8PSZPq2LEwVjyH5xXNBGTMXAqnXxmdUoDN2PUXfakq/dKWiFjKN+odcekhGyrxgEXS/f X-Received: by 2002:a05:6a20:3c91:b0:15c:e0bf:40ec with SMTP id b17-20020a056a203c9100b0015ce0bf40ecmr10387617pzj.17.1695759605868; Tue, 26 Sep 2023 13:20:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695759605; cv=none; d=google.com; s=arc-20160816; b=P2g6/mgw2LN1vDACYDHxyo6/xXFflO41et9KsbYK2ivXA0vzppmVUvhZtOFvCRrMq6 z5FLilhHrDE4HBGB1H/Bv4+zDP4tBj1e8XPiR6MZ1ujUTxiM1PWJblu+M9dLD39gNstr NpO34+1PPuLsQ7gb8gzzdntJPLxz/huprCD6OtpPGNWHcwvi/qUPQFV7luUqNap2r+6T Ce4XhAq6/B6nrancfPaktZ1uoH8eJIiSSKnzBcGYveXdg2QAj0UleVT+FwXd6KX32ww6 B3SLMSaYcP7epehEThkaAcvUwqLw4vkSYq6jMXZElLaKCj4x3SLasZL2AOaNzdJkv6gr NCdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=pn0F+kwsoTyRCnoC07T8ZrXe1y1Q9keK+1limegx/Wo=; fh=5dG6x1cYcRK0pGuP76GdEvYg/iV9nfSsz/LTc+yx700=; b=XMQD7f9gM5QkbxYkzy4flmZni4XAgweiLMJc69aGccNJryipK6FVM93H48HPq9R+L5 yuELpXxPfLWSr0fvgTEK5cXG8Q+M/pqx/ul4reN34On0yMbq8UNtAMrMsS6rtaiVare8 LhgJpeULpY0sJ0AbeHhPoXd6xDgePXylQGX1/9hO7Cf83QzOos4ouwsVj30QKT9MPejD N0bso/Y8vkheXJISdYc2Nw8EhLai2yE3pON6mu8bzdrxUBhbBXu/wtXF5P4oXxxEjzih fMvKurf1O+oS13lT20vZB7GMMB4zQCnWrxLi5NRBBBWif456deMiFco2T0AFKdJ5u/WA vHSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nrx6WWc2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id v10-20020a17090ac90a00b00277651787f1si4827773pjt.145.2023.09.26.13.20.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 13:20:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nrx6WWc2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 5BDBC819FC45; Tue, 26 Sep 2023 08:06:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234991AbjIZPGR (ORCPT + 99 others); Tue, 26 Sep 2023 11:06:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233134AbjIZPGQ (ORCPT ); Tue, 26 Sep 2023 11:06:16 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F99510A; Tue, 26 Sep 2023 08:06:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695740768; x=1727276768; h=message-id:subject:from:to:cc:date:in-reply-to: references:content-transfer-encoding:mime-version; bh=pn0F+kwsoTyRCnoC07T8ZrXe1y1Q9keK+1limegx/Wo=; b=nrx6WWc2IhIJwfqAyLuCIgGqTLSLHVvyMXepPSPelrwP7PLhSgiYhAu1 sXE0HqWcJ/cc9Z7JRAbVRJt85ddgZifGE0YNDzHzXoF0e+O0gNjaVxRgE qdjN/UHzN1ErmEF8QinZ0y+x0mnjcFuog/8NQLabynYUjjYIVpdBspHBv CKH+/n58tdZKn2K4lYKmOainyXSgZ8dF04BB9heKQwzSJwgt2pZYUxJp7 8vTgQpvB9b1laMj/ju2GmTzplnNzNwYpJiAGFij5MaP0YtSscFRYj+1r7 2etlv/1lYnNdZfrH7yBqw7hT1ISZxGtqntZtKaQ49cQPWmBDjgbSENJXE g==; X-IronPort-AV: E=McAfee;i="6600,9927,10845"; a="378864419" X-IronPort-AV: E=Sophos;i="6.03,178,1694761200"; d="scan'208";a="378864419" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Sep 2023 08:04:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10845"; a="839058453" X-IronPort-AV: E=Sophos;i="6.03,178,1694761200"; d="scan'208";a="839058453" Received: from spandruv-desk1.amr.corp.intel.com ([10.212.206.185]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Sep 2023 08:04:47 -0700 Message-ID: <9cab732f92d529d76b9e40f91ede1460320f1da4.camel@linux.intel.com> Subject: Re: [PATCH 3/3] platform/x86: intel_speed_select_if: Remove hardcoded map size From: srinivas pandruvada To: Andy Shevchenko Cc: hdegoede@redhat.com, markgross@kernel.org, ilpo.jarvinen@linux.intel.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 26 Sep 2023 08:04:46 -0700 In-Reply-To: References: <20230925194555.966743-1-srinivas.pandruvada@linux.intel.com> <20230925194555.966743-4-srinivas.pandruvada@linux.intel.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 26 Sep 2023 08:06:17 -0700 (PDT) On Tue, 2023-09-26 at 16:16 +0300, Andy Shevchenko wrote: > On Mon, Sep 25, 2023 at 12:45:55PM -0700, Srinivas Pandruvada wrote: > > The driver is using 256 as the size while calling devm_ioremap(). > > The > > maximum offset is already part of struct isst_mmio_range. Use the > > maximum offset (end field of the struct) plus 4 as the map size to > > remove > > hardcoded value of 256. >=20 > ... >=20 > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0punit_dev->mmio_range =3D (s= truct isst_mmio_range *) ent- > > >driver_data; > > + > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0punit_dev->punit_mmio =3D de= vm_ioremap(&pdev->dev, base_addr, > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 punit_dev- > > >mmio_range[1].end + sizeof(u32)); >=20 > Can we rather fix the mmio_range driver data to have end be actually > not the > offset of the last dword? (Better maybe to keep length there.) >=20 We can. But that has to be separate patch on top as there are other places this range is used. > With help of >=20 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0struct resource r; > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0... > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0r =3D DEFINE_RES_MEM(base= _addr, mmio_range.beg + > mmio_range.len); >=20 > you can switch to devm_ioremap_resource() API. What is the advantage of creating a resource and then call devm_ioremap_resource()? Thanks, Srinivas >=20