[PATCH RFC 3/4] kernel/resource: Make ioport_resource.start configurable

From: John Garry
Date: Fri Jan 15 2021 - 12:04:52 EST


Make IO space base address to be configurable through IO_SPACE_BASE.

This will allow architectures which do not natively support IO ports -
like arm64 - to harden against legacy ISA-based drivers which use
hardcoded addresses to access IO ports.

Any attempts for these drivers to request a resource region will now fail
for architectures with set IO_SPACE_BASE above legacy ISA IO port region
(0xffff).

Signed-off-by: John Garry <john.garry@xxxxxxxxxx>
---
kernel/resource.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/resource.c b/kernel/resource.c
index 3ae2f56cc79d..d191c4d796c7 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -29,7 +29,7 @@

struct resource ioport_resource = {
.name = "PCI IO",
- .start = 0,
+ .start = IO_SPACE_BASE,
.end = IO_SPACE_LIMIT,
.flags = IORESOURCE_IO,
};
--
2.26.2