Linux Documentation
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
To: Suseendran Bhaskaran <suseendranb@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	 Mike Rapoport <rppt@kernel.org>, Dan Williams <djbw@kernel.org>,
	 David Hildenbrand <david@kernel.org>,
	Alexander Graf <graf@amazon.com>,
	 Alison Schofield <alison.schofield@intel.com>,
	Andy Lutomirski <luto@kernel.org>,
	 Borislav Petkov <bp@alien8.de>,
	Catalin Marinas <catalin.marinas@arm.com>,
	 Changyuan Lyu <changyuanl@google.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	 Dave Jiang <dave.jiang@intel.com>,
	David Rientjes <rientjes@google.com>,
	 Frank van der Linden <fvdl@google.com>,
	"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
	 Ira Weiny <iweiny@kernel.org>, Jonathan Corbet <corbet@lwn.net>,
	 "Liam R. Howlett" <liam@infradead.org>,
	Mark Rutland <mark.rutland@arm.com>,
	 Michal Hocko <mhocko@suse.com>,
	Oscar Salvador <osalvador@suse.de>,
	 Pasha Tatashin <pasha.tatashin@soleen.com>,
	Peter Zijlstra <peterz@infradead.org>,
	 Pratyush Yadav <pratyush@kernel.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	 Shuah Khan <skhan@linuxfoundation.org>,
	Thomas Gleixner <tglx@kernel.org>,
	 Vishal Verma <vishal.l.verma@intel.com>,
	Vlastimil Babka <vbabka@kernel.org>,
	 Will Deacon <will@kernel.org>,
	kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org,
	 linux-cxl@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org,  linux-mm@kvack.org,
	nvdimm@lists.linux.dev, x86@kernel.org
Subject: Re: [RFC PATCH 06/11] dax/hmem: bind extmem platform devices with per-region alignment
Date: Thu, 3 Dec 2026 09:50:56 +0100	[thread overview]
Message-ID: <axErzFs_riTWoR9a@monoceros> (raw)
In-Reply-To: <20261202001946.1226273-7-suseendranb@google.com>

[-- Attachment #1: Type: text/plain, Size: 2876 bytes --]

Hello,

On Wed, Dec 02, 2026 at 12:19:41AM +0000, Suseendran Bhaskaran wrote:
> diff --git a/drivers/dax/Kconfig b/drivers/dax/Kconfig
> index 602f9a0839a9..834208398f4f 100644
> --- a/drivers/dax/Kconfig
> +++ b/drivers/dax/Kconfig
> @@ -29,7 +29,7 @@ config DEV_DAX_PMEM
>  
>  config DEV_DAX_HMEM
>  	tristate "HMEM DAX: direct access to 'specific purpose' memory"
> -	depends on EFI_SOFT_RESERVE
> +	depends on EFI_SOFT_RESERVE || EXTMEM
>  	select NUMA_KEEP_MEMINFO if NUMA_MEMBLKS
>  	default DEV_DAX
>  	depends on CXL_ACPI || !CXL_ACPI
> diff --git a/drivers/dax/hmem/hmem.c b/drivers/dax/hmem/hmem.c
> index af21f66bf872..e82ffbadfe20 100644
> --- a/drivers/dax/hmem/hmem.c
> +++ b/drivers/dax/hmem/hmem.c
> @@ -1,7 +1,9 @@
>  // SPDX-License-Identifier: GPL-2.0
>  #include <linux/platform_device.h>
> +#include <linux/mod_devicetable.h>

Please don't add that header. I work on removing it and
<linux/platform_device.h> already gives you struct platform_device_id.

>  #include <linux/memregion.h>
>  #include <linux/module.h>
> +#include <linux/string.h>
>  #include <linux/dax.h>
>  #include "../../cxl/cxl.h"
>  #include "../bus.h"
> @@ -11,24 +13,25 @@ module_param_named(region_idle, region_idle, bool, 0644);
>  
>  static int dax_hmem_probe(struct platform_device *pdev)
>  {
> -	unsigned long flags = IORESOURCE_DAX_KMEM;
>  	struct device *dev = &pdev->dev;
> +	struct memregion_info *mri = dev->platform_data;

IMHO this should be const, I think that needs another const for
alloc_dax_region() so that should probably go to a separate patch.

> +	bool is_hmem = strcmp(pdev->name, "hmem") == 0;
>  	struct dax_region *dax_region;
> -	struct memregion_info *mri;
>  	struct dev_dax_data data;
>  
> +	if ((!is_hmem && strcmp(pdev->name, "extmem") != 0) || !mri)
> +		return -EINVAL;
> +
>  	/*
>  	 * @region_idle == true indicates that an administrative agent
>  	 * wants to manipulate the range partitioning before the devices
>  	 * are created, so do not send them to the dax_kmem driver by
>  	 * default.
>  	 */
> -	if (region_idle)
> -		flags = 0;
> -
> -	mri = dev->platform_data;
>  	dax_region = alloc_dax_region(dev, pdev->id, &mri->range,
> -				      mri->target_node, PMD_SIZE, flags);
> +				      mri->target_node, mri->align ?: PMD_SIZE,
> +				      is_hmem && !region_idle ?
> +				      IORESOURCE_DAX_KMEM : 0);
>  	if (!dax_region)
>  		return -ENOMEM;
>  
> @@ -42,8 +45,16 @@ static int dax_hmem_probe(struct platform_device *pdev)
>  	return PTR_ERR_OR_ZERO(devm_create_dev_dax(&data));
>  }
>  
> +static const struct platform_device_id dax_hmem_ids[] = {
> +	{ "hmem" },
> +	{ "extmem" },

Please use named initializers here (i.e. `{ .name = "hmem" },`)

> +	{ }
> +};
> +MODULE_DEVICE_TABLE(platform, dax_hmem_ids);
> +

Best regards
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2026-12-03  8:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  0:19 [RFC PATCH 00/11] mm: NUMA-aware boot memory carving (extmem) Suseendran Bhaskaran
2026-12-02  0:19 ` [RFC PATCH 01/11] mm/cma: clamp multi-range search to 4G and honor memblock flags Suseendran Bhaskaran
2026-12-02  0:19 ` [RFC PATCH 02/11] mm/memblock: factor out multi-range contiguous reservation helper from CMA Suseendran Bhaskaran
2026-12-02  0:19 ` [RFC PATCH 03/11] x86/mm: add early direct-map unmap helpers for boot carveouts Suseendran Bhaskaran
2026-12-02  0:19 ` [RFC PATCH 04/11] arm64/mm: support unmapping boot carveouts from the linear map Suseendran Bhaskaran
2026-12-02  0:19 ` [RFC PATCH 05/11] mm/extmem: add architecture-neutral external memory subsystem Suseendran Bhaskaran
2026-12-02  0:19 ` [RFC PATCH 06/11] dax/hmem: bind extmem platform devices with per-region alignment Suseendran Bhaskaran
2026-12-03  8:50   ` Uwe Kleine-König [this message]
2026-12-02  0:19 ` [RFC PATCH 07/11] nvdimm/ramdax: manage bus and DIMM allocations with devres Suseendran Bhaskaran
2026-12-02  0:19 ` [RFC PATCH 08/11] nvdimm/ramdax: harden probe checks and select NUMA_KEEP_MEMINFO Suseendran Bhaskaran
2026-12-02  0:19 ` [RFC PATCH 09/11] nvdimm/ramdax: support binding extmem platform devices Suseendran Bhaskaran
2026-12-02  0:19 ` [RFC PATCH 10/11] x86/kaslr: avoid placing kernel in carvable high memory when extmem= is set Suseendran Bhaskaran
2026-12-02  0:19 ` [RFC PATCH 11/11] mm/extmem: preserve carved regions across KHO kexec Suseendran Bhaskaran
2026-12-02 14:45 ` [RFC PATCH 00/11] mm: NUMA-aware boot memory carving (extmem) Mike Rapoport
2026-12-02 15:10   ` David Hildenbrand (Arm)
2026-12-03  0:24     ` Suseendran Bhaskaran
2026-12-03  0:34 ` Dave Hansen

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=axErzFs_riTWoR9a@monoceros \
    --to=u.kleine-koenig@baylibre.com \
    --cc=akpm@linux-foundation.org \
    --cc=alison.schofield@intel.com \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=changyuanl@google.com \
    --cc=corbet@lwn.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=dave.jiang@intel.com \
    --cc=david@kernel.org \
    --cc=djbw@kernel.org \
    --cc=fvdl@google.com \
    --cc=graf@amazon.com \
    --cc=hpa@zytor.com \
    --cc=iweiny@kernel.org \
    --cc=kexec@lists.infradead.org \
    --cc=liam@infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mhocko@suse.com \
    --cc=mingo@redhat.com \
    --cc=nvdimm@lists.linux.dev \
    --cc=osalvador@suse.de \
    --cc=pasha.tatashin@soleen.com \
    --cc=peterz@infradead.org \
    --cc=pratyush@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=rientjes@google.com \
    --cc=rppt@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=suseendranb@google.com \
    --cc=tglx@kernel.org \
    --cc=vbabka@kernel.org \
    --cc=vishal.l.verma@intel.com \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox