Re: [PATCH RFC 10/13] xen: add ACPI bus to xen_nexus when running as Dom0

2014-02-14 Thread Roger Pau Monné
On 08/02/14 22:50, John Baldwin wrote:
 On Tuesday, December 24, 2013 12:20:59 PM Roger Pau Monne wrote:
 Also disable a couple of ACPI devices that are not usable under Dom0.
 
 Hmm, setting debug.acpi.disabled in this way is a bit hacky.  It might
 be fine however if there's no way for the user to set it before booting
 the kernel (as opposed to haing the relevant drivers explicitly disable
 themselves under Xen which I think would be cleaner, but would also
 make your patch larger)

Thanks for the review, the user can pass parameters to FreeBSD when
booted as Dom0, I just find it uncomfortable to force the user into
always setting something on the command line in order to boot.

What do you mean with haing the relevant drivers explicitly disable
themselves under Xen? Adding a gate on every one of those devices like
if (xen_pv_domain()) return (ENXIO); in the identify/probe routine
seems even worse.

Roger.
___
freebsd-xen@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-xen
To unsubscribe, send any mail to freebsd-xen-unsubscr...@freebsd.org


Re: [PATCH RFC 10/13] xen: add ACPI bus to xen_nexus when running as Dom0

2014-02-14 Thread John Baldwin
On Friday, February 14, 2014 5:38:15 am Roger Pau Monné wrote:
 On 08/02/14 22:50, John Baldwin wrote:
  On Tuesday, December 24, 2013 12:20:59 PM Roger Pau Monne wrote:
  Also disable a couple of ACPI devices that are not usable under Dom0.
  
  Hmm, setting debug.acpi.disabled in this way is a bit hacky.  It might
  be fine however if there's no way for the user to set it before booting
  the kernel (as opposed to haing the relevant drivers explicitly disable
  themselves under Xen which I think would be cleaner, but would also
  make your patch larger)
 
 Thanks for the review, the user can pass parameters to FreeBSD when
 booted as Dom0, I just find it uncomfortable to force the user into
 always setting something on the command line in order to boot.

Can the user set debug.acpi.disabled?  If so, you are overriding their
setting which would be bad.

 What do you mean with haing the relevant drivers explicitly disable
 themselves under Xen? Adding a gate on every one of those devices like
 if (xen_pv_domain()) return (ENXIO); in the identify/probe routine
 seems even worse.

A check like this in probe() is what I had in mind, though I agree it's
not perfect.

-- 
John Baldwin
___
freebsd-xen@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-xen
To unsubscribe, send any mail to freebsd-xen-unsubscr...@freebsd.org


[PATCH RFC 10/13] xen: add ACPI bus to xen_nexus when running as Dom0

2013-12-24 Thread Roger Pau Monne
Also disable a couple of ACPI devices that are not usable under Dom0.
---
 sys/x86/xen/xen_nexus.c |   24 +---
 1 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/sys/x86/xen/xen_nexus.c b/sys/x86/xen/xen_nexus.c
index 288e6b6..823b3bc 100644
--- a/sys/x86/xen/xen_nexus.c
+++ b/sys/x86/xen/xen_nexus.c
@@ -35,6 +35,10 @@ __FBSDID($FreeBSD$);
 #include sys/systm.h
 #include sys/smp.h
 
+#include contrib/dev/acpica/include/acpi.h
+
+#include dev/acpica/acpivar.h
+
 #include machine/nexusvar.h
 
 #include xen/xen-os.h
@@ -44,7 +48,6 @@ static const char *xen_devices[] =
xenstore, /* XenStore bus */
xen_et,   /* Xen PV timer (provides: tc, et, clk) */
xc,   /* Xen PV console */
-   isa,  /* Dummy ISA bus for sc to attach */
 };
 
 /*
@@ -56,13 +59,14 @@ nexus_xen_probe(device_t dev)
if (!xen_pv_domain())
return (ENXIO);
 
-   return (BUS_PROBE_DEFAULT);
+   return (BUS_PROBE_SPECIFIC);
 }
 
 static int
 nexus_xen_attach(device_t dev)
 {
int i, error = 0;
+   device_t acpi_dev;
 
nexus_init_resources();
bus_generic_probe(dev);
@@ -79,8 +83,22 @@ nexus_xen_attach(device_t dev)
if (BUS_ADD_CHILD(dev, 0, xen_devices[i], 0) == NULL)
panic(%s: could not add, xen_devices[i]);
}
+   if (xen_initial_domain()) {
+   /* Disable some ACPI devices that are not usable by Dom0 */
+   setenv(debug.acpi.disabled, cpu hpet timer);
+
+   acpi_dev = BUS_ADD_CHILD(dev, 10, acpi, 0);
+   if (acpi_dev == NULL)
+   panic(Unable to add ACPI bus to Xen Dom0);
+   } else {
+   /* Dummy ISA bus for sc to attach */
+   if (BUS_ADD_CHILD(dev, 0, isa, 0) == NULL)
+   panic(isa: could not add);
+   }
 
-   bus_generic_attach(dev);
+   error = bus_generic_attach(dev);
+   if (xen_initial_domain()  (error == 0))
+   acpi_install_wakeup_handler(device_get_softc(acpi_dev));
 
return (error);
 }
-- 
1.7.7.5 (Apple Git-26)

___
freebsd-xen@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-xen
To unsubscribe, send any mail to freebsd-xen-unsubscr...@freebsd.org