[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [Qemu-ppc][PATCH v5 1/4] Add usb option in machine options
From: |
zhlcindy |
Subject: |
[Qemu-devel] [Qemu-ppc][PATCH v5 1/4] Add usb option in machine options |
Date: |
Mon, 2 Jul 2012 13:25:33 +0800 |
From: Li Zhang <address@hidden>
pSeries machine needs to enable USB to add a USB
keyboard or USB mouse. -usb option won't be used in
the future, and machine options are a better way to
enable USB.
So this patch is to add USB option to machine options
(-machine type=pseries,usb=on/off) to enable/disable
USB controller. And machines will get the machine option
and create a USB controller if USB is on.
By the way, USB is on by default on pSeries machine.
So USB controller should be turned off explicitly through
the command line for "-nodefault" case as the following:
-machine type=pseries,usb=off.
Signed-off-by: Li Zhang <address@hidden>
Reviewed-by: Andreas Färber <address@hidden>
---
hw/spapr.c | 11 +++++++++++
qemu-config.c | 4 ++++
2 files changed, 15 insertions(+)
diff --git a/hw/spapr.c b/hw/spapr.c
index 81c9343..973de1b 100644
--- a/hw/spapr.c
+++ b/hw/spapr.c
@@ -575,6 +575,8 @@ static void ppc_spapr_init(ram_addr_t ram_size,
long load_limit, rtas_limit, fw_size;
long pteg_shift = 17;
char *filename;
+ QemuOpts *machine_opts;
+ bool add_usb = true;
spapr = g_malloc0(sizeof(*spapr));
QLIST_INIT(&spapr->phbs);
@@ -710,6 +712,15 @@ static void ppc_spapr_init(ram_addr_t ram_size,
spapr_vscsi_create(spapr->vio_bus);
}
+ machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
+ if (machine_opts) {
+ add_usb = qemu_opt_get_bool(machine_opts, "usb", true);
+ }
+
+ if (add_usb) {
+ pci_create_simple(QLIST_FIRST(&spapr->phbs)->host_state.bus,
+ -1, "pci-ohci");
+ }
if (rma_size < (MIN_RMA_SLOF << 20)) {
fprintf(stderr, "qemu: pSeries SLOF firmware requires >= "
"%ldM guest RMA (Real Mode Area memory)\n", MIN_RMA_SLOF);
diff --git a/qemu-config.c b/qemu-config.c
index 5c3296b..b86ee36 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -595,6 +595,10 @@ static QemuOptsList qemu_machine_opts = {
.name = "dt_compatible",
.type = QEMU_OPT_STRING,
.help = "Overrides the \"compatible\" property of the dt root
node",
+ },{
+ .name = "usb",
+ .type = QEMU_OPT_BOOL,
+ .help = "Set on/off to enable/disable usb",
},
{ /* End of list */ }
},
--
1.7.9.5
- [Qemu-devel] [Qemu-ppc][PATCH v5 0/4] Add USB option and enable vga on spapr, zhlcindy, 2012/07/02
- [Qemu-devel] [Qemu-ppc][PATCH v5 3/4] Cleanup pc.h on other platforms, zhlcindy, 2012/07/02
- [Qemu-devel] [Qemu-ppc][PATCH v5 1/4] Add usb option in machine options,
zhlcindy <=
- Re: [Qemu-devel] [Qemu-ppc][PATCH v5 1/4] Add usb option in machine options, Alexander Graf, 2012/07/06
- Re: [Qemu-devel] [Qemu-ppc][PATCH v5 1/4] Add usb option in machine options, Andreas Färber, 2012/07/06
- Re: [Qemu-devel] [Qemu-ppc][PATCH v5 1/4] Add usb option in machine options, Alexander Graf, 2012/07/06
- Re: [Qemu-devel] [Qemu-ppc][PATCH v5 1/4] Add usb option in machine options, Andreas Färber, 2012/07/06
- Re: [Qemu-devel] [Qemu-ppc][PATCH v5 1/4] Add usb option in machine options, Li Zhang, 2012/07/08
- Re: [Qemu-devel] [Qemu-ppc][PATCH v5 1/4] Add usb option in machine options, Alexander Graf, 2012/07/08
- Re: [Qemu-devel] [Qemu-ppc][PATCH v5 1/4] Add usb option in machine options, Li Zhang, 2012/07/08
- Re: [Qemu-devel] [Qemu-ppc][PATCH v5 1/4] Add usb option in machine options, Li Zhang, 2012/07/08
- Re: [Qemu-devel] [Qemu-ppc][PATCH v5 1/4] Add usb option in machine options, Alexander Graf, 2012/07/08
- Re: [Qemu-devel] [Qemu-ppc][PATCH v5 1/4] Add usb option in machine options, Li Zhang, 2012/07/08