Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp3148439rwo; Thu, 3 Aug 2023 23:26:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHwTPO/hLp2B0ThN0mYx/dN9gUHy42tczz6G6ODsFby3sHKCdi0FD79yBP+o1/BWQ8LgTO2 X-Received: by 2002:a17:906:20d5:b0:99b:237e:6ee with SMTP id c21-20020a17090620d500b0099b237e06eemr913787ejc.30.1691130408324; Thu, 03 Aug 2023 23:26:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691130408; cv=none; d=google.com; s=arc-20160816; b=o8q/yWKaJMPsvMdzb6vgTur7bm0uU/H4ZA1fzJtHj6zNDzuRXe9+dIPYeXax27Vy8/ POPlBWgwnLg7oTKPot9wWmdV7cAshszjxVjlNtBZ07pwb0EM1XCGvkUP0Dh26qcXLHZq W38vet/XfstvBNt3FN1KrB7Kog2TZR+cOOcP2qkslkAac2zg1KBoRso1RDJevwBbD9Hz DKaXkFZ0N4TwNNiKlZQUFMxijbROVKbRT9q+dhES/md4J8qu9snaL2BDlh4LUX72ozm2 S9NDC8BsvtQv+WtuHexTVAN0xHdFarsEZXiwI/p0Wh1QsGReUddeQPEFheEM/z/xPhk4 uolw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=zjLCxI5qKtfOuweYLBap47eCG46TAp9QrkBVCcuSVxw=; fh=jdC1wo04rAzKEpN+95FmIE0HbfvRQ3ImDXr2QY6+m/8=; b=pAL4E+YLtFCLiXV8XiU6FUFmHv1he5Tlh58ITMxkNJfgKOXfhvK9XsTPbtMWLo/FXX 7rqmrHymXCRecJsJrvg2aTACa3PYHO+x9wQv03SRVcbofGUZ/zF3fz0bXBfGcV5YISca 2Yg3cL/2/szM1CzIDT8HVxYiCceOHKTZiPZA4ll+wNdAGoabMxP75+RNJdLGf6VL67wu SHHf6i+K6VK1qooOw5Gd44+sJKCkp1SDkJjYYZtMFI9omKEN5SIm8uBgr96msVoA/sjb pT5CqLRTIRdnw2O1UwabfL0N/Cst90jFm6pkv+pU9zhr9LbuPRDR7F0nHrCx/A6ZU2bP GhoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KANJQQQ4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z13-20020a170906668d00b00992ee6da875si1148093ejo.218.2023.08.03.23.26.23; Thu, 03 Aug 2023 23:26:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KANJQQQ4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230500AbjHDGCC (ORCPT + 99 others); Fri, 4 Aug 2023 02:02:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229634AbjHDGA6 (ORCPT ); Fri, 4 Aug 2023 02:00:58 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D1A02708; Thu, 3 Aug 2023 23:00:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691128857; x=1722664857; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=SAvcwaw2V/Hs8D65jgLxC2s97VzPceMveowD167hosQ=; b=KANJQQQ4k0fSDtxjUANjqRnr57v5DXAhKwav/zIDgkCGNJ304xoGNi90 /Mc9zkJWuTlWnLlE+JXJ9h24jRTYhDh+jFq14hfd8t/MJ40RL3omMEA5e hM71oOgtVSMwswZTYQvelYJ7g7VPaM5UUHsYPb3o0I6/ktsrZovUUJW// f2f2lGx/H7V78q2z1PPHA9AEaoQTVL0Z7Hk1MWqizntbRPcREzjwFX12d qKJSYevfxxYkq7tNM14qVo8nMNf4a9m4LGl0aHnLqS1DRaY5g3ywo1mKa Oj9O5ex4xPkUFTBR/9RLYbHUzuhNJH1+O6iqtPag5+hSFgMWai4Ql55Nc A==; X-IronPort-AV: E=McAfee;i="6600,9927,10791"; a="367536838" X-IronPort-AV: E=Sophos;i="6.01,254,1684825200"; d="scan'208";a="367536838" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Aug 2023 23:00:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10791"; a="853584925" X-IronPort-AV: E=Sophos;i="6.01,254,1684825200"; d="scan'208";a="853584925" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga004.jf.intel.com with ESMTP; 03 Aug 2023 23:00:49 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1qRnrh-00CegX-2B; Fri, 04 Aug 2023 09:00:45 +0300 Date: Fri, 4 Aug 2023 09:00:45 +0300 From: Andy Shevchenko To: Sunil V L Cc: linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org, Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Catalin Marinas , Will Deacon , "Rafael J . Wysocki" , Len Brown , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , Daniel Lezcano , Thomas Gleixner , Anup Patel , Marc Zyngier , Bjorn Helgaas , Robert Moore , Haibo Xu , Andrew Jones , Conor Dooley , Atish Kumar Patra Subject: Re: [RFC PATCH v1 08/21] RISC-V: ACPI: RHCT: Add function to get CBO block sizes Message-ID: References: <20230803175916.3174453-1-sunilvl@ventanamicro.com> <20230803175916.3174453-9-sunilvl@ventanamicro.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230803175916.3174453-9-sunilvl@ventanamicro.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo 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,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On Thu, Aug 03, 2023 at 11:29:03PM +0530, Sunil V L wrote: > CBO related block size in ACPI is provided by RHCT. Add > support to read the CMO node in RHCT to get this information. ... > + if (!table) { Why not positive conditional? > + rhct = (struct acpi_table_rhct *)acpi_get_rhct(); > + if (!rhct) > + return -ENOENT; > + } else { > + rhct = (struct acpi_table_rhct *)table; > + } ... > + end = ACPI_ADD_PTR(struct acpi_rhct_node_header, rhct, rhct->header.length); > + Blank line here is not needed. > + for (node = ACPI_ADD_PTR(struct acpi_rhct_node_header, rhct, rhct->node_offset); > + node < end; > + node = ACPI_ADD_PTR(struct acpi_rhct_node_header, node, node->length)) { > + for (int i = 0; i < hart_info->num_offsets; i++) { > + ref_node = ACPI_ADD_PTR(struct acpi_rhct_node_header, > + rhct, hart_info_node_offset[i]); > + if (ref_node->type == ACPI_RHCT_NODE_TYPE_CMO) { > + cmo_node = ACPI_ADD_PTR(struct acpi_rhct_cmo_node, > + ref_node, size_hdr); > + if (cbom_size) > + *cbom_size = 1 << cmo_node->cbom_size; > + > + if (cboz_size) > + *cboz_size = 1 << cmo_node->cboz_size; > + > + if (cbop_size) > + *cbop_size = 1 << cmo_node->cbop_size; BIT() in all three cases? But how you guarantee it will not overflow? I mean who prevents cboX_size to be bigger than 30 (note also that 31 in your case is Undefined Behaviour in accordance with the C standard). > + return 0; > + } > + } > + } -- With Best Regards, Andy Shevchenko