All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Dave Jiang <dave.jiang@intel.com>
Cc: <linux-acpi@vger.kernel.org>, <linux-cxl@vger.kernel.org>,
	<rafael@kernel.org>, <lenb@kernel.org>,
	<dan.j.williams@intel.com>, <ira.weiny@intel.com>,
	<vishal.l.verma@intel.com>, <alison.schofield@intel.com>,
	<lukas@wunner.de>
Subject: Re: [PATCH v3 4/6] acpi: Break out nesting for hmat_parse_locality()
Date: Thu, 22 Jun 2023 14:40:23 +0100	[thread overview]
Message-ID: <20230622144023.000053f8@Huawei.com> (raw)
In-Reply-To: <168686424781.2950427.15323220900348586144.stgit@djiang5-mobl3>

On Thu, 15 Jun 2023 14:24:07 -0700
Dave Jiang <dave.jiang@intel.com> wrote:

> Refactor hmat_parse_locality() to break up the deep nesting of the
> function.
> 
> Suggested-by: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> ---
>  drivers/acpi/numa/hmat.c |   32 ++++++++++++++++++++------------
>  1 file changed, 20 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/acpi/numa/hmat.c b/drivers/acpi/numa/hmat.c
> index e2ab1cce0add..cb240f5233fe 100644
> --- a/drivers/acpi/numa/hmat.c
> +++ b/drivers/acpi/numa/hmat.c
> @@ -320,11 +320,28 @@ static __init void hmat_add_locality(struct acpi_hmat_locality *hmat_loc)
>  	}
>  }
>  
> +static __init void hmat_update_target(unsigned int tgt_pxm, unsigned int init_pxm,
> +				      u8 mem_hier, u8 type, u32 value)
> +{
> +	struct memory_target *target = find_mem_target(tgt_pxm);
> +
> +	if (mem_hier != ACPI_HMAT_MEMORY)
> +		return;
> +
> +	if (target && target->processor_pxm == init_pxm) {
> +		hmat_update_target_access(target, type, value,
> +					  NODE_ACCESS_CLASS_0);
> +		/* If the node has a CPU, update access 1 */
> +		if (node_state(pxm_to_node(init_pxm), N_CPU))
> +			hmat_update_target_access(target, type, value,
> +						  NODE_ACCESS_CLASS_1);
> +	}
> +}
> +
>  static __init int hmat_parse_locality(union acpi_subtable_headers *header,
>  				      const unsigned long end)
>  {
>  	struct acpi_hmat_locality *hmat_loc = (void *)header;
> -	struct memory_target *target;
>  	unsigned int init, targ, total_size, ipds, tpds;
>  	u32 *inits, *targs, value;
>  	u16 *entries;
> @@ -365,17 +382,8 @@ static __init int hmat_parse_locality(union acpi_subtable_headers *header,
>  				inits[init], targs[targ], value,
>  				hmat_data_type_suffix(type));
>  
> -			if (mem_hier == ACPI_HMAT_MEMORY) {
> -				target = find_mem_target(targs[targ]);
> -				if (target && target->processor_pxm == inits[init]) {
> -					hmat_update_target_access(target, type, value,
> -								  NODE_ACCESS_CLASS_0);
> -					/* If the node has a CPU, update access 1 */
> -					if (node_state(pxm_to_node(inits[init]), N_CPU))
> -						hmat_update_target_access(target, type, value,
> -									  NODE_ACCESS_CLASS_1);
> -				}
> -			}
> +			hmat_update_target(targs[targ], inits[init],
> +					   mem_hier, type, value);
>  		}
>  	}
>  
> 
> 
> 


  reply	other threads:[~2023-06-22 13:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-15 21:23 [PATCH v3 0/6] acpi: numa: add target support for generic port to HMAT parsing Dave Jiang
2023-06-15 21:23 ` [PATCH v3 1/6] acpi: numa: Create enum for memory_target access coordinates indexing Dave Jiang
2023-06-15 21:23 ` [PATCH v3 2/6] ACPICA: Add a define for size of acpi_srat_generic_affinity DeviceHandle Dave Jiang
2023-06-15 21:24 ` [PATCH v3 3/6] acpi: numa: Add genport target allocation to the HMAT parsing Dave Jiang
2023-06-22 13:45   ` Jonathan Cameron
2023-06-22 18:41     ` Dave Jiang
2023-06-15 21:24 ` [PATCH v3 4/6] acpi: Break out nesting for hmat_parse_locality() Dave Jiang
2023-06-22 13:40   ` Jonathan Cameron [this message]
2023-06-15 21:24 ` [PATCH v3 5/6] acpi: numa: Add setting of generic port system locality attributes Dave Jiang
2023-06-22 13:47   ` Jonathan Cameron
2023-06-15 21:24 ` [PATCH v3 6/6] acpi: numa: Add helper function to retrieve the performance attributes Dave Jiang
2023-06-16 17:58 ` [PATCH v3 0/6] acpi: numa: add target support for generic port to HMAT parsing Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230622144023.000053f8@Huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=ira.weiny@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=rafael@kernel.org \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.