From: Gregory Price <gourry@gourry.net>
To: linux-cxl@vger.kernel.org, x86@kernel.org, linux-mm@kvack.org,
linux-acpi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, dave.hansen@linux.intel.com,
luto@kernel.org, peterz@infradead.org, tglx@linutronix.de,
mingo@redhat.com, bp@alien8.de, hpa@zytor.com, david@redhat.com,
osalvador@suse.de, gregkh@linuxfoundation.org, rafael@kernel.org,
akpm@linux-foundation.org, dan.j.williams@intel.com,
Jonathan.Cameron@Huawei.com, alison.schofield@intel.com,
rrichter@amd.com, terry.bowman@amd.com, lenb@kernel.org,
dave.jiang@intel.com, ira.weiny@intel.com
Subject: [PATCH 1/3] memory: extern memory_block_size_bytes and set_memory_block_size_order
Date: Tue, 8 Oct 2024 00:43:53 -0400 [thread overview]
Message-ID: <20241008044355.4325-2-gourry@gourry.net> (raw)
In-Reply-To: <20241008044355.4325-1-gourry@gourry.net>
On CXL systems, block alignment may be as small as 256MB, which may
require a resize of the block size during initialization. This is done
in the ACPI driver, so the resize function need to be made available.
Presently, only x86 provides the functionality to resize memory
block sizes. Wire up a weak stub for set_memory_block_size_order,
similar to memory_block_size_bytes, that simply returns -ENODEV.
Since set_memory_block_size_order is now extern, we also need to
drop the __init macro.
Signed-off-by: Gregory Price <gourry@gourry.net>
---
arch/x86/mm/init_64.c | 2 +-
drivers/base/memory.c | 6 ++++++
include/linux/memory.h | 4 ++--
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index ff253648706f..6086f99449fa 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -1424,7 +1424,7 @@ void mark_rodata_ro(void)
/* Adjustable memory block size */
static unsigned long set_memory_block_size;
-int __init set_memory_block_size_order(unsigned int order)
+int set_memory_block_size_order(unsigned int order)
{
unsigned long size = 1UL << order;
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 67858eeb92ed..f9045642f69e 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -110,6 +110,12 @@ static void memory_block_release(struct device *dev)
kfree(mem);
}
+int __weak set_memory_block_size_order(unsigned int order)
+{
+ return -ENODEV;
+}
+EXPORT_SYMBOL_GPL(set_memory_block_size_order);
+
unsigned long __weak memory_block_size_bytes(void)
{
return MIN_MEMORY_BLOCK_SIZE;
diff --git a/include/linux/memory.h b/include/linux/memory.h
index c0afee5d126e..c57706178354 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -86,8 +86,8 @@ struct memory_block {
};
int arch_get_memory_phys_device(unsigned long start_pfn);
-unsigned long memory_block_size_bytes(void);
-int set_memory_block_size_order(unsigned int order);
+extern unsigned long memory_block_size_bytes(void);
+extern int set_memory_block_size_order(unsigned int order);
/* These states are exposed to userspace as text strings in sysfs */
#define MEM_ONLINE (1<<0) /* exposed to userspace */
--
2.43.0
next prev parent reply other threads:[~2024-10-08 14:00 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-08 4:43 [PATCH 0/3] memory,acpi: resize memory blocks based on CFMW alignment Gregory Price
2024-10-08 4:43 ` Gregory Price [this message]
2024-10-08 14:03 ` [PATCH 1/3] memory: extern memory_block_size_bytes and set_memory_block_size_order David Hildenbrand
2024-10-08 14:51 ` Gregory Price
2024-10-08 15:02 ` David Hildenbrand
2024-10-08 15:21 ` Gregory Price
2024-10-08 19:04 ` Ira Weiny
2024-10-08 19:45 ` Gregory Price
2024-10-14 11:54 ` David Hildenbrand
2024-10-14 14:25 ` Gregory Price
2024-10-14 20:32 ` David Hildenbrand
2024-10-14 22:40 ` Gregory Price
2024-10-08 4:43 ` [PATCH 2/3] x86/mm: if memblock size is adjusted, update the cached value Gregory Price
2024-10-08 4:43 ` [PATCH 3/3] acpi,srat: reduce memory block size if CFMWS has a smaller alignment Gregory Price
2024-10-08 14:58 ` Ira Weiny
2024-10-08 15:17 ` Gregory Price
2024-10-08 16:46 ` Dan Williams
2024-10-14 11:50 ` David Hildenbrand
2024-10-08 19:02 ` Ira Weiny
2024-10-08 14:38 ` [PATCH 0/3] memory,acpi: resize memory blocks based on CFMW alignment Ira Weiny
2024-10-08 14:49 ` Gregory Price
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=20241008044355.4325-2-gourry@gourry.net \
--to=gourry@gourry.net \
--cc=Jonathan.Cameron@Huawei.com \
--cc=akpm@linux-foundation.org \
--cc=alison.schofield@intel.com \
--cc=bp@alien8.de \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=dave.jiang@intel.com \
--cc=david@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=hpa@zytor.com \
--cc=ira.weiny@intel.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=osalvador@suse.de \
--cc=peterz@infradead.org \
--cc=rafael@kernel.org \
--cc=rrichter@amd.com \
--cc=terry.bowman@amd.com \
--cc=tglx@linutronix.de \
--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