Skip to contentSkip to conversation

x86: rtc_cmos platform device requires legacy irqs

PATCH In review David Vrabel 4 participants 21 messages Dec 3, 2015 – Dec 8, 2015 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: rtc_cmos platform device requires legacy irqs

Adding the rtc platform device when there are no legacy irqs (no legacy PIC) causes a conflict with other devices that end up using the same irq number.

In a single VCPU Xen PV guest we should have:

/proc/interrupts:
CPU0

  0:       4934  xen-percpu-virq      timer0
  1:          0  xen-percpu-ipi       spinlock0
  2:          0  xen-percpu-ipi       resched0
  3:          0  xen-percpu-ipi       callfunc0
  4:          0  xen-percpu-virq      debug0
  5:          0  xen-percpu-ipi       callfuncsingle0
  6:          0  xen-percpu-ipi       irqwork0
  7:        321   xen-dyn-event     xenbus
  8:         90   xen-dyn-event     hvc_console

...

But hvc_console cannot get its interrupt because it is already in use by rtc0 and the console does not work.

genirq: Flags mismatch irq 8. 00000000 (hvc_console) vs. 00000000 (rtc0)

The rtc_cmos device requires a particular legacy irq so don't add it if there are no legacy irqs.

---
 arch/x86/kernel/rtc.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/x86/kernel/rtc.c +5 -0
index cd96852..07c70f1 100644
@@ -14,6 +14,7 @@
 #include <asm/time.h>
 #include <asm/intel-mid.h>
 #include <asm/rtc.h>
+#include <asm/i8259.h>
 
 #ifdef CONFIG_X86_32
 /*
@@ -200,6 +201,10 @@ static __init int add_rtc_cmos(void)
 	}
 #endif
 
+	/* RTC uses legacy IRQs. */
+	if (!nr_legacy_irqs())
+		return -ENODEV;
+
 	platform_device_register(&rtc_device);
 	dev_info(&rtc_device.dev,
 		 "registered platform RTC device (no PNP device found)\n");
Signature · 1 line
2.1.4
#1 lore raw
Quoted 2 lines · David Vrabel

Adding the rtc platform device when there are no legacy irqs (no legacy PIC)

No PIC != No legacy IRQs, Hyper-V Gen2 represents such a platform (and it has RTC on irq8). I've tested this patch against it and it appears to work because the device is present in ACPI and we initialize it in drivers/acpi/acpi_cmos_rtc.c, add_rtc_cmos() bails out in the very beginning as we see PNP0b00 device.

Quoted 56 lines

causes a conflict with other devices that end up using the same irq number.

In a single VCPU Xen PV guest we should have:

/proc/interrupts:
CPU0

  0:       4934  xen-percpu-virq      timer0
  1:          0  xen-percpu-ipi       spinlock0
  2:          0  xen-percpu-ipi       resched0
  3:          0  xen-percpu-ipi       callfunc0
  4:          0  xen-percpu-virq      debug0
  5:          0  xen-percpu-ipi       callfuncsingle0
  6:          0  xen-percpu-ipi       irqwork0
  7:        321   xen-dyn-event     xenbus
  8:         90   xen-dyn-event     hvc_console

...

But hvc_console cannot get its interrupt because it is already in use by rtc0 and the console does not work.

genirq: Flags mismatch irq 8. 00000000 (hvc_console) vs. 00000000 (rtc0)

The rtc_cmos device requires a particular legacy irq so don't add it if there are no legacy irqs.

---
 arch/x86/kernel/rtc.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/x86/kernel/rtc.c +5 -0
index cd96852..07c70f1 100644
@@ -14,6 +14,7 @@
 #include <asm/time.h>
 #include <asm/intel-mid.h>
 #include <asm/rtc.h>
+#include <asm/i8259.h>
 
 #ifdef CONFIG_X86_32
 /*
@@ -200,6 +201,10 @@ static __init int add_rtc_cmos(void)
 	}
 #endif
 
+	/* RTC uses legacy IRQs. */
+	if (!nr_legacy_irqs())
+		return -ENODEV;
+
 	platform_device_register(&rtc_device);
 	dev_info(&rtc_device.dev,
 		 "registered platform RTC device (no PNP device found)\n");
Signature · 1 line
  Vitaly
#2 lore raw
Quoted 10 lines · Vitaly Kuznetsov
Quoted 2 lines · David Vrabel

Adding the rtc platform device when there are no legacy irqs (no legacy PIC)

No PIC != No legacy IRQs, Hyper-V Gen2 represents such a platform (and it has RTC on irq8). I've tested this patch against it and it appears to work because the device is present in ACPI and we initialize it in drivers/acpi/acpi_cmos_rtc.c, add_rtc_cmos() bails out in the very beginning as we see PNP0b00 device.

It's not a legacy IRQ if it isn't going via the legacy PIC, it just happens to have the same number.

I think it is safe to assume that any machine with a CMOS RTC but no PNP information is also going to have a legacy PIC.

David

#3 lore raw
In reply to Vitaly Kuznetsov
Quoted 10 lines · Vitaly Kuznetsov
Quoted 2 lines · David Vrabel

Adding the rtc platform device when there are no legacy irqs (no legacy PIC)

No PIC != No legacy IRQs, Hyper-V Gen2 represents such a platform (and it has RTC on irq8). I've tested this patch against it and it appears to work because the device is present in ACPI and we initialize it in drivers/acpi/acpi_cmos_rtc.c, add_rtc_cmos() bails out in the very beginning as we see PNP0b00 device.

It's not a legacy IRQ if it isn't going via the legacy PIC, it just happens to have the same number.

I think it is safe to assume that any machine with a CMOS RTC but no PNP information is also going to have a legacy PIC.

David

#4 lore raw
In reply to David Vrabel
Quoted 2 lines · David Vrabel

Adding the rtc platform device when there are no legacy irqs (no legacy PIC)

No PIC != No legacy IRQs, Hyper-V Gen2 represents such a platform (and it has RTC on irq8). I've tested this patch against it and it appears to work because the device is present in ACPI and we initialize it in drivers/acpi/acpi_cmos_rtc.c, add_rtc_cmos() bails out in the very beginning as we see PNP0b00 device.

Quoted 56 lines

causes a conflict with other devices that end up using the same irq number.

In a single VCPU Xen PV guest we should have:

/proc/interrupts:
CPU0

  0:       4934  xen-percpu-virq      timer0
  1:          0  xen-percpu-ipi       spinlock0
  2:          0  xen-percpu-ipi       resched0
  3:          0  xen-percpu-ipi       callfunc0
  4:          0  xen-percpu-virq      debug0
  5:          0  xen-percpu-ipi       callfuncsingle0
  6:          0  xen-percpu-ipi       irqwork0
  7:        321   xen-dyn-event     xenbus
  8:         90   xen-dyn-event     hvc_console

...

But hvc_console cannot get its interrupt because it is already in use by rtc0 and the console does not work.

genirq: Flags mismatch irq 8. 00000000 (hvc_console) vs. 00000000 (rtc0)

The rtc_cmos device requires a particular legacy irq so don't add it if there are no legacy irqs.

---
 arch/x86/kernel/rtc.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/x86/kernel/rtc.c +5 -0
index cd96852..07c70f1 100644
@@ -14,6 +14,7 @@
 #include <asm/time.h>
 #include <asm/intel-mid.h>
 #include <asm/rtc.h>
+#include <asm/i8259.h>
 
 #ifdef CONFIG_X86_32
 /*
@@ -200,6 +201,10 @@ static __init int add_rtc_cmos(void)
 	}
 #endif
 
+	/* RTC uses legacy IRQs. */
+	if (!nr_legacy_irqs())
+		return -ENODEV;
+
 	platform_device_register(&rtc_device);
 	dev_info(&rtc_device.dev,
 		 "registered platform RTC device (no PNP device found)\n");
Signature · 1 line
  Vitaly
author Tested-by Sander Eikelenboom on v1 1/1
#5 lore raw
In reply to David Vrabel
Quoted 3 lines · David Vrabel

Adding the rtc platform device when there are no legacy irqs (no legacy PIC) causes a conflict with other devices that end up using the same irq number.

An alternative is to remove the rtc_cmos platform device in Xen PV guests.

Any preference on how this regression should be fixed?

David

8<--------------------------
x86: Xen PV guests don't have the rtc_cmos platform device

Adding the rtc platform device in a Xen PV guests causes an IRQ conflict because these guests do not have a legacy PIC.

In a single VCPU Xen PV guest we should have:

/proc/interrupts:
CPU0

  0:       4934  xen-percpu-virq      timer0
  1:          0  xen-percpu-ipi       spinlock0
  2:          0  xen-percpu-ipi       resched0
  3:          0  xen-percpu-ipi       callfunc0
  4:          0  xen-percpu-virq      debug0
  5:          0  xen-percpu-ipi       callfuncsingle0
  6:          0  xen-percpu-ipi       irqwork0
  7:        321   xen-dyn-event     xenbus
  8:         90   xen-dyn-event     hvc_console

...

But hvc_console cannot get its interrupt because it is already in use by rtc0 and the console does not work.

genirq: Flags mismatch irq 8. 00000000 (hvc_console) vs. 00000000 (rtc0)

So don't add the rtc_cmos device in Xen PV guests.

---
 arch/x86/kernel/rtc.c | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/kernel/rtc.c +3 -0
index cd96852..7b190b8 100644
@@ -200,6 +200,9 @@ static __init int add_rtc_cmos(void)
 	}
 #endif
 
+	if (xen_pv_domain())
+		return -ENODEV;
+
 	platform_device_register(&rtc_device);
 	dev_info(&rtc_device.dev,
 		 "registered platform RTC device (no PNP device found)\n");
Signature · 1 line
2.1.4
#6 lore raw
Quoted 15 lines · David Vrabel
Quoted 3 lines · David Vrabel

Adding the rtc platform device when there are no legacy irqs (no legacy PIC) causes a conflict with other devices that end up using the same irq number.

An alternative is to remove the rtc_cmos platform device in Xen PV guests.

Any preference on how this regression should be fixed?

David

8<--------------------------
x86: Xen PV guests don't have the rtc_cmos platform device

[...]

arch/x86/kernel/rtc.c static __init int add_rtc_cmos(void) · line 205

Quoted 9 lines
arch/x86/kernel/rtc.c +3 -0
@@ -200,6 +200,9 @@ static __init int add_rtc_cmos(void)
 	}
 #endif
 
+	if (xen_pv_domain())
+		return -ENODEV;
+

Note there's a missing include that breaks !XEN builds.

David

#7 lore raw
Quoted 22 lines · David Vrabel
Quoted 14 lines · David Vrabel
Quoted 3 lines · David Vrabel

Adding the rtc platform device when there are no legacy irqs (no legacy PIC) causes a conflict with other devices that end up using the same irq number.

An alternative is to remove the rtc_cmos platform device in Xen PV guests.

Any preference on how this regression should be fixed?

David

8<--------------------------
x86: Xen PV guests don't have the rtc_cmos platform device

[...]

Quoted 6 lines
arch/x86/kernel/rtc.c +0 -0
@@ -200,6 +200,9 @@ static __init int add_rtc_cmos(void)
  	}
  #endif
 
Quoted 4 lines

arch/x86/kernel/rtc.c static __init int add_rtc_cmos(void) · line 205

Quoted 3 lines
arch/x86/kernel/rtc.c +3 -0
+	if (xen_pv_domain())
+		return -ENODEV;
+

Note there's a missing include that breaks !XEN builds.

We could also use paravirt_enable() here which will probably cover HVMlite case as well. (Until we start turning on and off various HVMlite features).

Don't know how it will affect lguest (which so far is the only other paravirt-enabled guest).

-boris

#8 lore raw
In reply to David Vrabel
Quoted 22 lines · David Vrabel
Quoted 14 lines · David Vrabel
Quoted 3 lines · David Vrabel

Adding the rtc platform device when there are no legacy irqs (no legacy PIC) causes a conflict with other devices that end up using the same irq number.

An alternative is to remove the rtc_cmos platform device in Xen PV guests.

Any preference on how this regression should be fixed?

David

8<--------------------------
x86: Xen PV guests don't have the rtc_cmos platform device

[...]

Quoted 6 lines
arch/x86/kernel/rtc.c +0 -0
@@ -200,6 +200,9 @@ static __init int add_rtc_cmos(void)
  	}
  #endif
 
Quoted 4 lines

arch/x86/kernel/rtc.c static __init int add_rtc_cmos(void) · line 205

Quoted 3 lines
arch/x86/kernel/rtc.c +3 -0
+	if (xen_pv_domain())
+		return -ENODEV;
+

Note there's a missing include that breaks !XEN builds.

We could also use paravirt_enable() here which will probably cover HVMlite case as well. (Until we start turning on and off various HVMlite features).

Don't know how it will affect lguest (which so far is the only other paravirt-enabled guest).

-boris

#9 lore raw
Quoted 27 lines · Boris Ostrovsky
Quoted 16 lines · David Vrabel
Quoted 14 lines · David Vrabel
Quoted 3 lines · David Vrabel

Adding the rtc platform device when there are no legacy irqs (no legacy PIC) causes a conflict with other devices that end up using the same irq number.

An alternative is to remove the rtc_cmos platform device in Xen PV guests.

Any preference on how this regression should be fixed?

David

8<--------------------------
x86: Xen PV guests don't have the rtc_cmos platform device

[...]

Quoted 9 lines

arch/x86/kernel/rtc.c static __init int add_rtc_cmos(void) · line 204

Quoted 8 lines
arch/x86/kernel/rtc.c +2 -0
@@ -200,6 +200,9 @@ static __init int add_rtc_cmos(void)
  	}
  #endif
  +	if (xen_pv_domain())
+		return -ENODEV;
+

Note there's a missing include that breaks !XEN builds.

Quoted 3 lines

We could also use paravirt_enable() here which will probably cover HVMlite case as well. (Until we start turning on and off various HVMlite features).

Would it make sense to create a new abstraction, e.g. 'rtc_available' in struct hypervisor_x86?

Signature · 1 line
  Vitaly
#10 lore raw
Quoted 28 lines · Vitaly Kuznetsov
Quoted 26 lines · Boris Ostrovsky
Quoted 25 lines · David Vrabel
Quoted 14 lines · David Vrabel
Quoted 3 lines · David Vrabel

Adding the rtc platform device when there are no legacy irqs (no legacy PIC) causes a conflict with other devices that end up using the same irq number.

An alternative is to remove the rtc_cmos platform device in Xen PV guests.

Any preference on how this regression should be fixed?

David

8<--------------------------
x86: Xen PV guests don't have the rtc_cmos platform device

[...]

arch/x86/kernel/rtc.c static __init int add_rtc_cmos(void) · line 204

Quoted 8 lines
arch/x86/kernel/rtc.c +2 -0
@@ -200,6 +200,9 @@ static __init int add_rtc_cmos(void)
   	}
   #endif
   +	if (xen_pv_domain())
+		return -ENODEV;
+

Note there's a missing include that breaks !XEN builds.

Quoted 5 lines
Quoted 3 lines

We could also use paravirt_enable() here which will probably cover HVMlite case as well. (Until we start turning on and off various HVMlite features).

Would it make sense to create a new abstraction, e.g. 'rtc_available' in struct hypervisor_x86?

We could do this but since this fine-grained feature enabling is still way off it may be worth waiting until we actually get to this.

Besides, it would probably be something like if (paravirt_enabled() && !rtc_available) so for now having just the first term should suffice.

-boris

#11 lore raw
In reply to Vitaly Kuznetsov
Quoted 28 lines · Vitaly Kuznetsov
Quoted 26 lines · Boris Ostrovsky
Quoted 25 lines · David Vrabel
Quoted 14 lines · David Vrabel
Quoted 3 lines · David Vrabel

Adding the rtc platform device when there are no legacy irqs (no legacy PIC) causes a conflict with other devices that end up using the same irq number.

An alternative is to remove the rtc_cmos platform device in Xen PV guests.

Any preference on how this regression should be fixed?

David

8<--------------------------
x86: Xen PV guests don't have the rtc_cmos platform device

[...]

arch/x86/kernel/rtc.c static __init int add_rtc_cmos(void) · line 204

Quoted 8 lines
arch/x86/kernel/rtc.c +2 -0
@@ -200,6 +200,9 @@ static __init int add_rtc_cmos(void)
   	}
   #endif
   +	if (xen_pv_domain())
+		return -ENODEV;
+

Note there's a missing include that breaks !XEN builds.

Quoted 5 lines
Quoted 3 lines

We could also use paravirt_enable() here which will probably cover HVMlite case as well. (Until we start turning on and off various HVMlite features).

Would it make sense to create a new abstraction, e.g. 'rtc_available' in struct hypervisor_x86?

We could do this but since this fine-grained feature enabling is still way off it may be worth waiting until we actually get to this.

Besides, it would probably be something like if (paravirt_enabled() && !rtc_available) so for now having just the first term should suffice.

-boris

#12 lore raw
In reply to Boris Ostrovsky
Quoted 27 lines · Boris Ostrovsky
Quoted 16 lines · David Vrabel
Quoted 14 lines · David Vrabel
Quoted 3 lines · David Vrabel

Adding the rtc platform device when there are no legacy irqs (no legacy PIC) causes a conflict with other devices that end up using the same irq number.

An alternative is to remove the rtc_cmos platform device in Xen PV guests.

Any preference on how this regression should be fixed?

David

8<--------------------------
x86: Xen PV guests don't have the rtc_cmos platform device

[...]

Quoted 9 lines

arch/x86/kernel/rtc.c static __init int add_rtc_cmos(void) · line 204

Quoted 8 lines
arch/x86/kernel/rtc.c +2 -0
@@ -200,6 +200,9 @@ static __init int add_rtc_cmos(void)
  	}
  #endif
  +	if (xen_pv_domain())
+		return -ENODEV;
+

Note there's a missing include that breaks !XEN builds.

Quoted 3 lines

We could also use paravirt_enable() here which will probably cover HVMlite case as well. (Until we start turning on and off various HVMlite features).

Would it make sense to create a new abstraction, e.g. 'rtc_available' in struct hypervisor_x86?

Signature · 1 line
  Vitaly
#13 lore raw
In reply to David Vrabel
Quoted 23 lines · David Vrabel
Quoted 15 lines · David Vrabel
Quoted 3 lines · David Vrabel

Adding the rtc platform device when there are no legacy irqs (no legacy PIC) causes a conflict with other devices that end up using the same irq number.

An alternative is to remove the rtc_cmos platform device in Xen PV guests.

Any preference on how this regression should be fixed?

David

8<--------------------------
x86: Xen PV guests don't have the rtc_cmos platform device

[...]

Quoted 6 lines
arch/x86/kernel/rtc.c +0 -0
@@ -200,6 +200,9 @@ static __init int add_rtc_cmos(void)
 	}
 #endif
 
Quoted 5 lines

arch/x86/kernel/rtc.c static __init int add_rtc_cmos(void) · line 205

Quoted 3 lines
arch/x86/kernel/rtc.c +3 -0
+	if (xen_pv_domain())
+		return -ENODEV;
+

Note there's a missing include that breaks !XEN builds.

What's the state of this?

#14 lore raw
Quoted 23 lines · Thomas Gleixner
Quoted 22 lines · David Vrabel
Quoted 14 lines · David Vrabel
Quoted 3 lines · David Vrabel

Adding the rtc platform device when there are no legacy irqs (no legacy PIC) causes a conflict with other devices that end up using the same irq number.

An alternative is to remove the rtc_cmos platform device in Xen PV guests.

Any preference on how this regression should be fixed?

David

8<--------------------------
x86: Xen PV guests don't have the rtc_cmos platform device

[...]

Quoted 6 lines
arch/x86/kernel/rtc.c +0 -0
@@ -200,6 +200,9 @@ static __init int add_rtc_cmos(void)
  	}
  #endif
 
Quoted 5 lines
Quoted 4 lines

arch/x86/kernel/rtc.c static __init int add_rtc_cmos(void) · line 205

Quoted 3 lines
arch/x86/kernel/rtc.c +3 -0
+	if (xen_pv_domain())
+		return -ENODEV;
+

Note there's a missing include that breaks !XEN builds.

What's the state of this?

I think we are waiting for x86 maintainers to express their preference. There were 3 proposals to add in add_rtc_cmos()

1. if (!nr_legacy_irqs())

            return -ENODEV;

2. #ifdef XEN

        if (xen_pv_domain())
                return -ENODEV;
    #endif

3. if (paravirt_enabled())

            return -ENODEV;

-boris

#15 lore raw
Quoted 18 lines · Boris Ostrovsky
Quoted 10 lines · Thomas Gleixner
Quoted 9 lines

arch/x86/kernel/rtc.c static __init int add_rtc_cmos(void) · line 204

Quoted 8 lines
arch/x86/kernel/rtc.c +2 -0
@@ -200,6 +200,9 @@ static __init int add_rtc_cmos(void)
  	}
  #endif
  +	if (xen_pv_domain())
+		return -ENODEV;
+

Note there's a missing include that breaks !XEN builds.

What's the state of this?

I think we are waiting for x86 maintainers to express their preference. There were 3 proposals to add in add_rtc_cmos()

1. if (!nr_legacy_irqs())

            return -ENODEV;
Quoted 7 lines

2. #ifdef XEN

        if (xen_pv_domain())
                return -ENODEV;
    #endif

3. if (paravirt_enabled())

            return -ENODEV;

Either #2 (but with the #ifdefs removed, include the proper header instead) or #3.

Thanks,

tglx

#16 lore raw
In reply to Boris Ostrovsky
Quoted 18 lines · Boris Ostrovsky
Quoted 10 lines · Thomas Gleixner
Quoted 9 lines

arch/x86/kernel/rtc.c static __init int add_rtc_cmos(void) · line 204

Quoted 8 lines
arch/x86/kernel/rtc.c +2 -0
@@ -200,6 +200,9 @@ static __init int add_rtc_cmos(void)
  	}
  #endif
  +	if (xen_pv_domain())
+		return -ENODEV;
+

Note there's a missing include that breaks !XEN builds.

What's the state of this?

I think we are waiting for x86 maintainers to express their preference. There were 3 proposals to add in add_rtc_cmos()

1. if (!nr_legacy_irqs())

            return -ENODEV;
Quoted 7 lines

2. #ifdef XEN

        if (xen_pv_domain())
                return -ENODEV;
    #endif

3. if (paravirt_enabled())

            return -ENODEV;

Either #2 (but with the #ifdefs removed, include the proper header instead) or #3.

Thanks,

tglx

#17 lore raw
In reply to Thomas Gleixner
Quoted 23 lines · Thomas Gleixner
Quoted 22 lines · David Vrabel
Quoted 14 lines · David Vrabel
Quoted 3 lines · David Vrabel

Adding the rtc platform device when there are no legacy irqs (no legacy PIC) causes a conflict with other devices that end up using the same irq number.

An alternative is to remove the rtc_cmos platform device in Xen PV guests.

Any preference on how this regression should be fixed?

David

8<--------------------------
x86: Xen PV guests don't have the rtc_cmos platform device

[...]

Quoted 6 lines
arch/x86/kernel/rtc.c +0 -0
@@ -200,6 +200,9 @@ static __init int add_rtc_cmos(void)
  	}
  #endif
 
Quoted 5 lines
Quoted 4 lines

arch/x86/kernel/rtc.c static __init int add_rtc_cmos(void) · line 205

Quoted 3 lines
arch/x86/kernel/rtc.c +3 -0
+	if (xen_pv_domain())
+		return -ENODEV;
+

Note there's a missing include that breaks !XEN builds.

What's the state of this?

I think we are waiting for x86 maintainers to express their preference. There were 3 proposals to add in add_rtc_cmos()

1. if (!nr_legacy_irqs())

            return -ENODEV;

2. #ifdef XEN

        if (xen_pv_domain())
                return -ENODEV;
    #endif

3. if (paravirt_enabled())

            return -ENODEV;

-boris

#18 lore raw
In reply to David Vrabel
Quoted 23 lines · David Vrabel
Quoted 15 lines · David Vrabel
Quoted 3 lines · David Vrabel

Adding the rtc platform device when there are no legacy irqs (no legacy PIC) causes a conflict with other devices that end up using the same irq number.

An alternative is to remove the rtc_cmos platform device in Xen PV guests.

Any preference on how this regression should be fixed?

David

8<--------------------------
x86: Xen PV guests don't have the rtc_cmos platform device

[...]

Quoted 6 lines
arch/x86/kernel/rtc.c +0 -0
@@ -200,6 +200,9 @@ static __init int add_rtc_cmos(void)
 	}
 #endif
 
Quoted 5 lines

arch/x86/kernel/rtc.c static __init int add_rtc_cmos(void) · line 205

Quoted 3 lines
arch/x86/kernel/rtc.c +3 -0
+	if (xen_pv_domain())
+		return -ENODEV;
+

Note there's a missing include that breaks !XEN builds.

What's the state of this?

#19 lore raw
In reply to David Vrabel
Quoted 15 lines · David Vrabel
Quoted 3 lines · David Vrabel

Adding the rtc platform device when there are no legacy irqs (no legacy PIC) causes a conflict with other devices that end up using the same irq number.

An alternative is to remove the rtc_cmos platform device in Xen PV guests.

Any preference on how this regression should be fixed?

David

8<--------------------------
x86: Xen PV guests don't have the rtc_cmos platform device

[...]

arch/x86/kernel/rtc.c static __init int add_rtc_cmos(void) · line 205

Quoted 9 lines
arch/x86/kernel/rtc.c +3 -0
@@ -200,6 +200,9 @@ static __init int add_rtc_cmos(void)
 	}
 #endif
 
+	if (xen_pv_domain())
+		return -ENODEV;
+

Note there's a missing include that breaks !XEN builds.

David

author Tested-by Sander Eikelenboom on v1 1/1
#20 lore raw
In reply to David Vrabel
Quoted 3 lines · David Vrabel

Adding the rtc platform device when there are no legacy irqs (no legacy PIC) causes a conflict with other devices that end up using the same irq number.

An alternative is to remove the rtc_cmos platform device in Xen PV guests.

Any preference on how this regression should be fixed?

David

8<--------------------------
x86: Xen PV guests don't have the rtc_cmos platform device

Adding the rtc platform device in a Xen PV guests causes an IRQ conflict because these guests do not have a legacy PIC.

In a single VCPU Xen PV guest we should have:

/proc/interrupts:
CPU0

  0:       4934  xen-percpu-virq      timer0
  1:          0  xen-percpu-ipi       spinlock0
  2:          0  xen-percpu-ipi       resched0
  3:          0  xen-percpu-ipi       callfunc0
  4:          0  xen-percpu-virq      debug0
  5:          0  xen-percpu-ipi       callfuncsingle0
  6:          0  xen-percpu-ipi       irqwork0
  7:        321   xen-dyn-event     xenbus
  8:         90   xen-dyn-event     hvc_console

...

But hvc_console cannot get its interrupt because it is already in use by rtc0 and the console does not work.

genirq: Flags mismatch irq 8. 00000000 (hvc_console) vs. 00000000 (rtc0)

So don't add the rtc_cmos device in Xen PV guests.

---
 arch/x86/kernel/rtc.c | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/kernel/rtc.c +3 -0
index cd96852..7b190b8 100644
@@ -200,6 +200,9 @@ static __init int add_rtc_cmos(void)
 	}
 #endif
 
+	if (xen_pv_domain())
+		return -ENODEV;
+
 	platform_device_register(&rtc_device);
 	dev_info(&rtc_device.dev,
 		 "registered platform RTC device (no PNP device found)\n");
Signature · 1 line
2.1.4