linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/6] resource: Set struct resource types correctly
@ 2017-12-05  0:39 Bjorn Helgaas
  2017-12-05  0:40 ` [PATCH v1 1/6] vgacon: Set VGA struct resource types Bjorn Helgaas
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Bjorn Helgaas @ 2017-12-05  0:39 UTC (permalink / raw)
  Cc: Jason Cooper, Bartlomiej Zolnierkiewicz, Marc Zyngier,
	Benjamin Herrenschmidt, linux-kernel, Ralf Baechle,
	Paul Mackerras, Michael Ellerman, Ivan Kokshaysky,
	Thomas Gleixner, Yinghai Lu, Matt Turner, Richard Henderson

We have several places that insert struct resources into the iomem_resource
or ioport_resource trees without setting the type.  This *works* fine
because it's obvious that a resource must be the same type as its parent,
but it does mean that if we ever print the resource with %pR, it doesn't
print correctly.

These patches fix all the cases I found.  Ideally I'd like to merge all
these through my PCI tree because I'm working on some legacy resource
changes that do cause some of these resources to be printed.

---

Bjorn Helgaas (6):
      vgacon: Set VGA struct resource types
      MIPS: Set I/O port resource types correctly
      powerpc: Set I/O port resource types correctly
      irqchip/i8259: Set I/O port resource types correctly
      resource: Set type of "reserve=" user-specified resources
      resource: Set type when reserving new regions


 Documentation/admin-guide/kernel-parameters.txt |    6 +++-
 arch/alpha/kernel/console.c                     |    1 +
 arch/mips/jazz/setup.c                          |    8 +++--
 arch/mips/mti-malta/malta-setup.c               |   10 +++----
 arch/powerpc/platforms/maple/time.c             |    2 +
 arch/powerpc/sysdev/i8259.c                     |    6 ++--
 drivers/irqchip/irq-i8259.c                     |    4 +--
 drivers/video/console/vgacon.c                  |   34 ++++++++++++++++++-----
 kernel/resource.c                               |   29 ++++++++++++++------
 9 files changed, 68 insertions(+), 32 deletions(-)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v1 1/6] vgacon: Set VGA struct resource types
  2017-12-05  0:39 [PATCH v1 0/6] resource: Set struct resource types correctly Bjorn Helgaas
@ 2017-12-05  0:40 ` Bjorn Helgaas
  2018-01-03 15:10   ` Bartlomiej Zolnierkiewicz
  2017-12-05  0:40 ` [PATCH v1 2/6] MIPS: Set I/O port resource types correctly Bjorn Helgaas
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 8+ messages in thread
From: Bjorn Helgaas @ 2017-12-05  0:40 UTC (permalink / raw)
  Cc: Jason Cooper, Bartlomiej Zolnierkiewicz, Marc Zyngier,
	Benjamin Herrenschmidt, linux-kernel, Ralf Baechle,
	Paul Mackerras, Michael Ellerman, Ivan Kokshaysky,
	Thomas Gleixner, Yinghai Lu, Matt Turner, Richard Henderson

From: Bjorn Helgaas <bhelgaas@google.com>

Set the resource type when we reserve VGA-related I/O port resources.

The resource code doesn't actually look at the type, so it inserts
resources without a type in the tree correctly even without this change.
But if we ever print a resource without a type, it looks like this:

  vga+ [??? 0x000003c0-0x000003df flags 0x0]

Setting the type means it will be printed correctly as:

  vga+ [io  0x000003c0-0x000003df]

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 arch/alpha/kernel/console.c    |    1 +
 drivers/video/console/vgacon.c |   34 ++++++++++++++++++++++++++--------
 2 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/arch/alpha/kernel/console.c b/arch/alpha/kernel/console.c
index 8e9a41966881..5476279329a6 100644
--- a/arch/alpha/kernel/console.c
+++ b/arch/alpha/kernel/console.c
@@ -21,6 +21,7 @@
 struct pci_controller *pci_vga_hose;
 static struct resource alpha_vga = {
 	.name	= "alpha-vga+",
+	.flags	= IORESOURCE_IO,
 	.start	= 0x3C0,
 	.end	= 0x3DF
 };
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index 445b1dc5d441..a17ba1465815 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -422,7 +422,10 @@ static const char *vgacon_startup(void)
 		vga_video_port_val = VGA_CRT_DM;
 		if ((screen_info.orig_video_ega_bx & 0xff) != 0x10) {
 			static struct resource ega_console_resource =
-			    { .name = "ega", .start = 0x3B0, .end = 0x3BF };
+			    { .name	= "ega",
+			      .flags	= IORESOURCE_IO,
+			      .start	= 0x3B0,
+			      .end	= 0x3BF };
 			vga_video_type = VIDEO_TYPE_EGAM;
 			vga_vram_size = 0x8000;
 			display_desc = "EGA+";
@@ -430,9 +433,15 @@ static const char *vgacon_startup(void)
 					 &ega_console_resource);
 		} else {
 			static struct resource mda1_console_resource =
-			    { .name = "mda", .start = 0x3B0, .end = 0x3BB };
+			    { .name	= "mda",
+			      .flags	= IORESOURCE_IO,
+			      .start	= 0x3B0,
+			      .end	= 0x3BB };
 			static struct resource mda2_console_resource =
-			    { .name = "mda", .start = 0x3BF, .end = 0x3BF };
+			    { .name	= "mda",
+			      .flags	= IORESOURCE_IO,
+			      .start	= 0x3BF,
+			      .end	= 0x3BF };
 			vga_video_type = VIDEO_TYPE_MDA;
 			vga_vram_size = 0x2000;
 			display_desc = "*MDA";
@@ -454,15 +463,21 @@ static const char *vgacon_startup(void)
 			vga_vram_size = 0x8000;
 
 			if (!screen_info.orig_video_isVGA) {
-				static struct resource ega_console_resource
-				    = { .name = "ega", .start = 0x3C0, .end = 0x3DF };
+				static struct resource ega_console_resource =
+				    { .name	= "ega",
+				      .flags	= IORESOURCE_IO,
+				      .start	= 0x3C0,
+				      .end	= 0x3DF };
 				vga_video_type = VIDEO_TYPE_EGAC;
 				display_desc = "EGA";
 				request_resource(&ioport_resource,
 						 &ega_console_resource);
 			} else {
-				static struct resource vga_console_resource
-				    = { .name = "vga+", .start = 0x3C0, .end = 0x3DF };
+				static struct resource vga_console_resource =
+				    { .name	= "vga+",
+				      .flags	= IORESOURCE_IO,
+				      .start	= 0x3C0,
+				      .end	= 0x3DF };
 				vga_video_type = VIDEO_TYPE_VGAC;
 				display_desc = "VGA+";
 				request_resource(&ioport_resource,
@@ -494,7 +509,10 @@ static const char *vgacon_startup(void)
 			}
 		} else {
 			static struct resource cga_console_resource =
-			    { .name = "cga", .start = 0x3D4, .end = 0x3D5 };
+			    { .name	= "cga",
+			      .flags	= IORESOURCE_IO,
+			      .start	= 0x3D4,
+			      .end	= 0x3D5 };
 			vga_video_type = VIDEO_TYPE_CGA;
 			vga_vram_size = 0x2000;
 			display_desc = "*CGA";

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v1 2/6] MIPS: Set I/O port resource types correctly
  2017-12-05  0:39 [PATCH v1 0/6] resource: Set struct resource types correctly Bjorn Helgaas
  2017-12-05  0:40 ` [PATCH v1 1/6] vgacon: Set VGA struct resource types Bjorn Helgaas
@ 2017-12-05  0:40 ` Bjorn Helgaas
  2017-12-05  0:40 ` [PATCH v1 3/6] powerpc: " Bjorn Helgaas
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Bjorn Helgaas @ 2017-12-05  0:40 UTC (permalink / raw)
  Cc: Jason Cooper, Bartlomiej Zolnierkiewicz, Marc Zyngier,
	Benjamin Herrenschmidt, linux-kernel, Ralf Baechle,
	Paul Mackerras, Michael Ellerman, Ivan Kokshaysky,
	Thomas Gleixner, Yinghai Lu, Matt Turner, Richard Henderson

From: Bjorn Helgaas <bhelgaas@google.com>

Set I/O port resource structs to have IORESOURCE_IO in their type field.

Previously we marked these as merely IORESOURCE_BUSY without indicating the
type.  Setting the type doesn't fix any functional problem but makes %pR
on the resource work better.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 arch/mips/jazz/setup.c            |    8 ++++----
 arch/mips/mti-malta/malta-setup.c |   10 +++++-----
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/mips/jazz/setup.c b/arch/mips/jazz/setup.c
index e4374a5651ce..448fd41792e4 100644
--- a/arch/mips/jazz/setup.c
+++ b/arch/mips/jazz/setup.c
@@ -32,22 +32,22 @@ static struct resource jazz_io_resources[] = {
 		.start	= 0x00,
 		.end	= 0x1f,
 		.name	= "dma1",
-		.flags	= IORESOURCE_BUSY
+		.flags	= IORESOURCE_IO | IORESOURCE_BUSY
 	}, {
 		.start	= 0x40,
 		.end	= 0x5f,
 		.name	= "timer",
-		.flags	= IORESOURCE_BUSY
+		.flags	= IORESOURCE_IO | IORESOURCE_BUSY
 	}, {
 		.start	= 0x80,
 		.end	= 0x8f,
 		.name	= "dma page reg",
-		.flags	= IORESOURCE_BUSY
+		.flags	= IORESOURCE_IO | IORESOURCE_BUSY
 	}, {
 		.start	= 0xc0,
 		.end	= 0xdf,
 		.name	= "dma2",
-		.flags	= IORESOURCE_BUSY
+		.flags	= IORESOURCE_IO | IORESOURCE_BUSY
 	}
 };
 
diff --git a/arch/mips/mti-malta/malta-setup.c b/arch/mips/mti-malta/malta-setup.c
index de34adb76157..7b63914d2e58 100644
--- a/arch/mips/mti-malta/malta-setup.c
+++ b/arch/mips/mti-malta/malta-setup.c
@@ -47,31 +47,31 @@ static struct resource standard_io_resources[] = {
 		.name = "dma1",
 		.start = 0x00,
 		.end = 0x1f,
-		.flags = IORESOURCE_BUSY
+		.flags = IORESOURCE_IO | IORESOURCE_BUSY
 	},
 	{
 		.name = "timer",
 		.start = 0x40,
 		.end = 0x5f,
-		.flags = IORESOURCE_BUSY
+		.flags = IORESOURCE_IO | IORESOURCE_BUSY
 	},
 	{
 		.name = "keyboard",
 		.start = 0x60,
 		.end = 0x6f,
-		.flags = IORESOURCE_BUSY
+		.flags = IORESOURCE_IO | IORESOURCE_BUSY
 	},
 	{
 		.name = "dma page reg",
 		.start = 0x80,
 		.end = 0x8f,
-		.flags = IORESOURCE_BUSY
+		.flags = IORESOURCE_IO | IORESOURCE_BUSY
 	},
 	{
 		.name = "dma2",
 		.start = 0xc0,
 		.end = 0xdf,
-		.flags = IORESOURCE_BUSY
+		.flags = IORESOURCE_IO | IORESOURCE_BUSY
 	},
 };
 

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v1 3/6] powerpc: Set I/O port resource types correctly
  2017-12-05  0:39 [PATCH v1 0/6] resource: Set struct resource types correctly Bjorn Helgaas
  2017-12-05  0:40 ` [PATCH v1 1/6] vgacon: Set VGA struct resource types Bjorn Helgaas
  2017-12-05  0:40 ` [PATCH v1 2/6] MIPS: Set I/O port resource types correctly Bjorn Helgaas
@ 2017-12-05  0:40 ` Bjorn Helgaas
  2017-12-05  0:40 ` [PATCH v1 4/6] irqchip/i8259: " Bjorn Helgaas
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Bjorn Helgaas @ 2017-12-05  0:40 UTC (permalink / raw)
  Cc: Jason Cooper, Bartlomiej Zolnierkiewicz, Marc Zyngier,
	Benjamin Herrenschmidt, linux-kernel, Ralf Baechle,
	Paul Mackerras, Michael Ellerman, Ivan Kokshaysky,
	Thomas Gleixner, Yinghai Lu, Matt Turner, Richard Henderson

From: Bjorn Helgaas <bhelgaas@google.com>

Set I/O port resource structs to have IORESOURCE_IO in their type field.

Previously we marked these as merely IORESOURCE_BUSY without indicating the
type.  Setting the type doesn't fix any functional problem but makes %pR
on the resource work better.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 arch/powerpc/platforms/maple/time.c |    2 +-
 arch/powerpc/sysdev/i8259.c         |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/maple/time.c b/arch/powerpc/platforms/maple/time.c
index 81799d70a1ee..cfddc87f81bf 100644
--- a/arch/powerpc/platforms/maple/time.c
+++ b/arch/powerpc/platforms/maple/time.c
@@ -134,7 +134,7 @@ int maple_set_rtc_time(struct rtc_time *tm)
 
 static struct resource rtc_iores = {
 	.name = "rtc",
-	.flags = IORESOURCE_BUSY,
+	.flags = IORESOURCE_IO | IORESOURCE_BUSY,
 };
 
 unsigned long __init maple_get_boot_time(void)
diff --git a/arch/powerpc/sysdev/i8259.c b/arch/powerpc/sysdev/i8259.c
index bafb014e1a7e..cb9a8b71fd0f 100644
--- a/arch/powerpc/sysdev/i8259.c
+++ b/arch/powerpc/sysdev/i8259.c
@@ -145,21 +145,21 @@ static struct resource pic1_iores = {
 	.name = "8259 (master)",
 	.start = 0x20,
 	.end = 0x21,
-	.flags = IORESOURCE_BUSY,
+	.flags = IORESOURCE_IO | IORESOURCE_BUSY,
 };
 
 static struct resource pic2_iores = {
 	.name = "8259 (slave)",
 	.start = 0xa0,
 	.end = 0xa1,
-	.flags = IORESOURCE_BUSY,
+	.flags = IORESOURCE_IO | IORESOURCE_BUSY,
 };
 
 static struct resource pic_edgectrl_iores = {
 	.name = "8259 edge control",
 	.start = 0x4d0,
 	.end = 0x4d1,
-	.flags = IORESOURCE_BUSY,
+	.flags = IORESOURCE_IO | IORESOURCE_BUSY,
 };
 
 static int i8259_host_match(struct irq_domain *h, struct device_node *node,

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v1 4/6] irqchip/i8259: Set I/O port resource types correctly
  2017-12-05  0:39 [PATCH v1 0/6] resource: Set struct resource types correctly Bjorn Helgaas
                   ` (2 preceding siblings ...)
  2017-12-05  0:40 ` [PATCH v1 3/6] powerpc: " Bjorn Helgaas
@ 2017-12-05  0:40 ` Bjorn Helgaas
  2017-12-05  0:40 ` [PATCH v1 5/6] resource: Set type of "reserve=" user-specified resources Bjorn Helgaas
  2017-12-05  0:40 ` [PATCH v1 6/6] resource: Set type when reserving new regions Bjorn Helgaas
  5 siblings, 0 replies; 8+ messages in thread
From: Bjorn Helgaas @ 2017-12-05  0:40 UTC (permalink / raw)
  Cc: Jason Cooper, Bartlomiej Zolnierkiewicz, Marc Zyngier,
	Benjamin Herrenschmidt, linux-kernel, Ralf Baechle,
	Paul Mackerras, Michael Ellerman, Ivan Kokshaysky,
	Thomas Gleixner, Yinghai Lu, Matt Turner, Richard Henderson

From: Bjorn Helgaas <bhelgaas@google.com>

Set I/O port resource structs to have IORESOURCE_IO in their type field.

Previously we marked these as merely IORESOURCE_BUSY without indicating the
type.  Setting the type doesn't fix any functional problem but makes %pR
on the resource work better.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/irqchip/irq-i8259.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-i8259.c b/drivers/irqchip/irq-i8259.c
index 7aafbb091b67..b0d4aab1a58c 100644
--- a/drivers/irqchip/irq-i8259.c
+++ b/drivers/irqchip/irq-i8259.c
@@ -289,14 +289,14 @@ static struct resource pic1_io_resource = {
 	.name = "pic1",
 	.start = PIC_MASTER_CMD,
 	.end = PIC_MASTER_IMR,
-	.flags = IORESOURCE_BUSY
+	.flags = IORESOURCE_IO | IORESOURCE_BUSY
 };
 
 static struct resource pic2_io_resource = {
 	.name = "pic2",
 	.start = PIC_SLAVE_CMD,
 	.end = PIC_SLAVE_IMR,
-	.flags = IORESOURCE_BUSY
+	.flags = IORESOURCE_IO | IORESOURCE_BUSY
 };
 
 static int i8259A_irq_domain_map(struct irq_domain *d, unsigned int virq,

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v1 5/6] resource: Set type of "reserve=" user-specified resources
  2017-12-05  0:39 [PATCH v1 0/6] resource: Set struct resource types correctly Bjorn Helgaas
                   ` (3 preceding siblings ...)
  2017-12-05  0:40 ` [PATCH v1 4/6] irqchip/i8259: " Bjorn Helgaas
@ 2017-12-05  0:40 ` Bjorn Helgaas
  2017-12-05  0:40 ` [PATCH v1 6/6] resource: Set type when reserving new regions Bjorn Helgaas
  5 siblings, 0 replies; 8+ messages in thread
From: Bjorn Helgaas @ 2017-12-05  0:40 UTC (permalink / raw)
  Cc: Jason Cooper, Bartlomiej Zolnierkiewicz, Marc Zyngier,
	Benjamin Herrenschmidt, linux-kernel, Ralf Baechle,
	Paul Mackerras, Michael Ellerman, Ivan Kokshaysky,
	Thomas Gleixner, Yinghai Lu, Matt Turner, Richard Henderson

From: Bjorn Helgaas <bhelgaas@google.com>

When we reserve regions because the user specified a "reserve=" parameter,
set the resource type to either IORESOURCE_IO (for regions below 0x10000)
or IORESOURCE_MEM.  The test for 0x10000 is just a heuristic; obviously
there can be memory below 0x10000 as well.

Improve documentation of the "reserve=" parameter.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 Documentation/admin-guide/kernel-parameters.txt |    6 +++++-
 kernel/resource.c                               |   24 +++++++++++++++++------
 2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 6571fbfdb2a1..78cdf6a637fc 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -3675,7 +3675,11 @@
 			[KNL, SMP] Set scheduler's default relax_domain_level.
 			See Documentation/cgroup-v1/cpusets.txt.
 
-	reserve=	[KNL,BUGS] Force the kernel to ignore some iomem area
+	reserve=	[KNL,BUGS] Force kernel to ignore I/O ports or memory
+			Format: <base1>,<size1>[,<base2>,<size2>,...]
+			Reserve I/O ports or memory so the kernel won't use
+			them.  If <base> is less than 0x10000, the region
+			is assumed to be I/O ports; otherwise it is memory.
 
 	reservetop=	[X86-32]
 			Format: nn[KMG]
diff --git a/kernel/resource.c b/kernel/resource.c
index 54ba6de3757c..ba3252f7c319 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -1478,7 +1478,7 @@ void __devm_release_region(struct device *dev, struct resource *parent,
 EXPORT_SYMBOL(__devm_release_region);
 
 /*
- * Called from init/main.c to reserve IO ports.
+ * Reserve I/O ports or memory based on "reserve=" kernel parameter.
  */
 #define MAXRESERVE 4
 static int __init reserve_setup(char *str)
@@ -1489,26 +1489,38 @@ static int __init reserve_setup(char *str)
 	for (;;) {
 		unsigned int io_start, io_num;
 		int x = reserved;
+		struct resource *parent;
 
-		if (get_option (&str, &io_start) != 2)
+		if (get_option(&str, &io_start) != 2)
 			break;
-		if (get_option (&str, &io_num)   == 0)
+		if (get_option(&str, &io_num) == 0)
 			break;
 		if (x < MAXRESERVE) {
 			struct resource *res = reserve + x;
+
+			/*
+			 * If the region starts below 0x10000, we assume it's
+			 * I/O port space; otherwise assume it's memory.
+			 */
+			if (io_start < 0x10000) {
+				res->flags = IORESOURCE_IO;
+				parent = &ioport_resource;
+			} else {
+				res->flags = IORESOURCE_MEM;
+				parent = &iomem_resource;
+			}
 			res->name = "reserved";
 			res->start = io_start;
 			res->end = io_start + io_num - 1;
-			res->flags = IORESOURCE_BUSY;
+			res->flags |= IORESOURCE_BUSY;
 			res->desc = IORES_DESC_NONE;
 			res->child = NULL;
-			if (request_resource(res->start >= 0x10000 ? &iomem_resource : &ioport_resource, res) == 0)
+			if (request_resource(parent, res) == 0)
 				reserved = x+1;
 		}
 	}
 	return 1;
 }
-
 __setup("reserve=", reserve_setup);
 
 /*

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v1 6/6] resource: Set type when reserving new regions
  2017-12-05  0:39 [PATCH v1 0/6] resource: Set struct resource types correctly Bjorn Helgaas
                   ` (4 preceding siblings ...)
  2017-12-05  0:40 ` [PATCH v1 5/6] resource: Set type of "reserve=" user-specified resources Bjorn Helgaas
@ 2017-12-05  0:40 ` Bjorn Helgaas
  5 siblings, 0 replies; 8+ messages in thread
From: Bjorn Helgaas @ 2017-12-05  0:40 UTC (permalink / raw)
  Cc: Jason Cooper, Bartlomiej Zolnierkiewicz, Marc Zyngier,
	Benjamin Herrenschmidt, linux-kernel, Ralf Baechle,
	Paul Mackerras, Michael Ellerman, Ivan Kokshaysky,
	Thomas Gleixner, Yinghai Lu, Matt Turner, Richard Henderson

From: Bjorn Helgaas <bhelgaas@google.com>

Set resource structs inserted by __reserve_region_with_split() to have the
correct type.  Setting the type doesn't fix any functional problem but
makes %pR on the resource work better.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 kernel/resource.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/resource.c b/kernel/resource.c
index ba3252f7c319..8c527d83ca76 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -1022,6 +1022,7 @@ static void __init __reserve_region_with_split(struct resource *root,
 	struct resource *conflict;
 	struct resource *res = alloc_resource(GFP_ATOMIC);
 	struct resource *next_res = NULL;
+	int type = resource_type(root);
 
 	if (!res)
 		return;
@@ -1029,7 +1030,7 @@ static void __init __reserve_region_with_split(struct resource *root,
 	res->name = name;
 	res->start = start;
 	res->end = end;
-	res->flags = IORESOURCE_BUSY;
+	res->flags = type | IORESOURCE_BUSY;
 	res->desc = IORES_DESC_NONE;
 
 	while (1) {
@@ -1064,7 +1065,7 @@ static void __init __reserve_region_with_split(struct resource *root,
 				next_res->name = name;
 				next_res->start = conflict->end + 1;
 				next_res->end = end;
-				next_res->flags = IORESOURCE_BUSY;
+				next_res->flags = type | IORESOURCE_BUSY;
 				next_res->desc = IORES_DESC_NONE;
 			}
 		} else {

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 1/6] vgacon: Set VGA struct resource types
  2017-12-05  0:40 ` [PATCH v1 1/6] vgacon: Set VGA struct resource types Bjorn Helgaas
@ 2018-01-03 15:10   ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 8+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2018-01-03 15:10 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Jason Cooper, Marc Zyngier, Benjamin Herrenschmidt, linux-kernel,
	Ralf Baechle, Paul Mackerras, Michael Ellerman, Ivan Kokshaysky,
	Thomas Gleixner, Yinghai Lu, Matt Turner, Richard Henderson

On Monday, December 04, 2017 06:40:04 PM Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
> 
> Set the resource type when we reserve VGA-related I/O port resources.
> 
> The resource code doesn't actually look at the type, so it inserts
> resources without a type in the tree correctly even without this change.
> But if we ever print a resource without a type, it looks like this:
> 
>   vga+ [??? 0x000003c0-0x000003df flags 0x0]
> 
> Setting the type means it will be printed correctly as:
> 
>   vga+ [io  0x000003c0-0x000003df]
> 
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-01-03 15:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-05  0:39 [PATCH v1 0/6] resource: Set struct resource types correctly Bjorn Helgaas
2017-12-05  0:40 ` [PATCH v1 1/6] vgacon: Set VGA struct resource types Bjorn Helgaas
2018-01-03 15:10   ` Bartlomiej Zolnierkiewicz
2017-12-05  0:40 ` [PATCH v1 2/6] MIPS: Set I/O port resource types correctly Bjorn Helgaas
2017-12-05  0:40 ` [PATCH v1 3/6] powerpc: " Bjorn Helgaas
2017-12-05  0:40 ` [PATCH v1 4/6] irqchip/i8259: " Bjorn Helgaas
2017-12-05  0:40 ` [PATCH v1 5/6] resource: Set type of "reserve=" user-specified resources Bjorn Helgaas
2017-12-05  0:40 ` [PATCH v1 6/6] resource: Set type when reserving new regions Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).