[PATCH 01/10] resource: add flags parameter to __request_region
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Aug 15 08:32:00 PDT 2022
__request_region allocates a child resource within the parent resource,
which so far always had a flags field of zero. Later commits will
use the flags field to mark reserved SDRAM regions, so MMU init code can
take that into consideration and ensure that CPU doesn't speculate into
these regions and risk aborts. Prepare for this by giving
__request_region a flags parameter.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
common/memory.c | 4 ++--
common/resource.c | 13 +++++++------
include/linux/ioport.h | 4 ++--
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/common/memory.c b/common/memory.c
index fd782c7f24f6..03fec1f1eb0e 100644
--- a/common/memory.c
+++ b/common/memory.c
@@ -208,8 +208,8 @@ struct resource *request_sdram_region(const char *name, resource_size_t start,
for_each_memory_bank(bank) {
struct resource *res;
- res = __request_region(bank->res, name, start,
- start + size - 1);
+ res = __request_region(bank->res, start, start + size - 1,
+ name, 0);
if (!IS_ERR(res))
return res;
}
diff --git a/common/resource.c b/common/resource.c
index f96cb94b5074..81f337668ef1 100644
--- a/common/resource.c
+++ b/common/resource.c
@@ -28,8 +28,8 @@ static int init_resource(struct resource *res, const char *name)
* resources.
*/
struct resource *__request_region(struct resource *parent,
- const char *name, resource_size_t start,
- resource_size_t end)
+ resource_size_t start, resource_size_t end,
+ const char *name, unsigned flags)
{
struct resource *r, *new;
@@ -73,15 +73,16 @@ struct resource *__request_region(struct resource *parent,
}
ok:
- debug("%s ok: 0x%08llx:0x%08llx\n", __func__,
+ debug("%s ok: 0x%08llx:0x%08llx flags=%u\n", __func__,
(unsigned long long)start,
- (unsigned long long)end);
+ (unsigned long long)end, flags);
new = xzalloc(sizeof(*new));
init_resource(new, name);
new->start = start;
new->end = end;
new->parent = parent;
+ new->flags = flags;
list_add_tail(&new->sibling, &r->sibling);
return new;
@@ -138,7 +139,7 @@ struct resource iomem_resource = {
struct resource *request_iomem_region(const char *name,
resource_size_t start, resource_size_t end)
{
- return __request_region(&iomem_resource, name, start, end);
+ return __request_region(&iomem_resource, start, end, name, 0);
}
/* The root resource for the whole io-mapped io space */
@@ -157,7 +158,7 @@ struct resource *request_ioport_region(const char *name,
{
struct resource *res;
- res = __request_region(&ioport_resource, name, start, end);
+ res = __request_region(&ioport_resource, start, end, name, 0);
if (IS_ERR(res))
return ERR_CAST(res);
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index ee9587ba0feb..c6328e9a7fc2 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -155,8 +155,8 @@ struct resource *request_ioport_region(const char *name,
resource_size_t start, resource_size_t end);
struct resource *__request_region(struct resource *parent,
- const char *name, resource_size_t end,
- resource_size_t size);
+ resource_size_t start, resource_size_t end,
+ const char *name, unsigned flags);
int __merge_regions(const char *name,
struct resource *resa, struct resource *resb);
--
2.30.2
More information about the barebox
mailing list