Message ID | 1386061881-12720-6-git-send-email-lig.fnst@cn.fujitsu.com |
---|---|
State | New |
Headers | show |
On Tue, Dec 3, 2013 at 7:11 PM, liguang <lig.fnst@cn.fujitsu.com> wrote: > Signed-off-by: liguang <lig.fnst@cn.fujitsu.com> > --- > hw/arm/Makefile.objs | 2 +- > hw/arm/cubieboard.c | 33 +++++++++++++++++++++++++++++++++ > 2 files changed, 34 insertions(+), 1 deletions(-) > create mode 100644 hw/arm/cubieboard.c > > diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs > index b9e5983..8be8d8e 100644 > --- a/hw/arm/Makefile.objs > +++ b/hw/arm/Makefile.objs > @@ -4,4 +4,4 @@ obj-y += omap_sx1.o palm.o realview.o spitz.o stellaris.o > obj-y += tosa.o versatilepb.o vexpress.o xilinx_zynq.o z2.o > > obj-y += armv7m.o exynos4210.o pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o > -obj-y += omap1.o omap2.o strongarm.o allwinner-a10.o > +obj-y += omap1.o omap2.o strongarm.o allwinner-a10.o cubieboard.o > diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c > new file mode 100644 > index 0000000..a5be21c > --- /dev/null > +++ b/hw/arm/cubieboard.c > @@ -0,0 +1,33 @@ > +#include "hw/sysbus.h" > +#include "hw/devices.h" > +#include "hw/boards.h" > +#include "hw/arm/allwinner-a10.h" > + > + > +static struct arm_boot_info cubieboard_binfo = { > + .loader_start = A10_SDRAM_BASE, > + .board_id = 0x1008, > +}; > + > +static void cubieboard_init(QEMUMachineInitArgs *args) > +{ > + A10State *s = a10_init(get_system_memory(), args->ram_size); > + > + cubieboard_binfo.ram_size = args->ram_size; > + cubieboard_binfo.kernel_filename = args->kernel_filename; > + cubieboard_binfo.kernel_cmdline = args->kernel_cmdline; I cant help but think that serial attachment needs to happen on the board level. but im not sure how this can be made to work with the un-qomified serial_mm_init, so no block from me unless Andreas has a better idea. > + arm_load_kernel(s->cpu, &cubieboard_binfo); > +} > + > +static QEMUMachine cubieboard_machine = { > + .name = "cubieboard", > + .init = cubieboard_init, I think you should add at least the long descriptor so -M help plays nice. Regards, Peter > +}; > + > + > +static void cubieboard_machine_init(void) > +{ > + qemu_register_machine(&cubieboard_machine); > +} > + > +machine_init(cubieboard_machine_init); > -- > 1.7.2.5 > >
Am 03.12.2013 13:01, schrieb Peter Crosthwaite: > On Tue, Dec 3, 2013 at 7:11 PM, liguang <lig.fnst@cn.fujitsu.com> wrote: >> Signed-off-by: liguang <lig.fnst@cn.fujitsu.com> >> --- >> hw/arm/Makefile.objs | 2 +- >> hw/arm/cubieboard.c | 33 +++++++++++++++++++++++++++++++++ >> 2 files changed, 34 insertions(+), 1 deletions(-) >> create mode 100644 hw/arm/cubieboard.c >> >> diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs >> index b9e5983..8be8d8e 100644 >> --- a/hw/arm/Makefile.objs >> +++ b/hw/arm/Makefile.objs >> @@ -4,4 +4,4 @@ obj-y += omap_sx1.o palm.o realview.o spitz.o stellaris.o >> obj-y += tosa.o versatilepb.o vexpress.o xilinx_zynq.o z2.o >> >> obj-y += armv7m.o exynos4210.o pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o >> -obj-y += omap1.o omap2.o strongarm.o allwinner-a10.o >> +obj-y += omap1.o omap2.o strongarm.o allwinner-a10.o cubieboard.o >> diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c >> new file mode 100644 >> index 0000000..a5be21c >> --- /dev/null >> +++ b/hw/arm/cubieboard.c >> @@ -0,0 +1,33 @@ >> +#include "hw/sysbus.h" >> +#include "hw/devices.h" >> +#include "hw/boards.h" >> +#include "hw/arm/allwinner-a10.h" >> + >> + >> +static struct arm_boot_info cubieboard_binfo = { >> + .loader_start = A10_SDRAM_BASE, >> + .board_id = 0x1008, >> +}; >> + >> +static void cubieboard_init(QEMUMachineInitArgs *args) >> +{ >> + A10State *s = a10_init(get_system_memory(), args->ram_size); >> + >> + cubieboard_binfo.ram_size = args->ram_size; >> + cubieboard_binfo.kernel_filename = args->kernel_filename; >> + cubieboard_binfo.kernel_cmdline = args->kernel_cmdline; > > I cant help but think that serial attachment needs to happen on the > board level. but im not sure how this can be made to work with the > un-qomified serial_mm_init, so no block from me unless Andreas has a > better idea. I don't have an immediate solution, same problem in Tegra2 code. If someone is willing to convert serial_mm into QOM-friendly form that would be nice but I will be unavailable for review the next ~two weeks. What I do wonder here is why this is calling a new a10_init() rather than object_new() and related QOM APIs. get_system_memory() can without problems be called inside the device. If RAM is really on the SoC (it is for Tegra2/3) then it could become a property of the device with MemoryRegion initialization in realize - that is still unclean in my code IIRC. >> + arm_load_kernel(s->cpu, &cubieboard_binfo); >> +} [...] >> +machine_init(cubieboard_machine_init); No semicolon here please, it's a function. Regards, Andreas
Peter Crosthwaite wrote: > On Tue, Dec 3, 2013 at 7:11 PM, liguang<lig.fnst@cn.fujitsu.com> wrote: > >> Signed-off-by: liguang<lig.fnst@cn.fujitsu.com> >> --- >> hw/arm/Makefile.objs | 2 +- >> hw/arm/cubieboard.c | 33 +++++++++++++++++++++++++++++++++ >> 2 files changed, 34 insertions(+), 1 deletions(-) >> create mode 100644 hw/arm/cubieboard.c >> >> diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs >> index b9e5983..8be8d8e 100644 >> --- a/hw/arm/Makefile.objs >> +++ b/hw/arm/Makefile.objs >> @@ -4,4 +4,4 @@ obj-y += omap_sx1.o palm.o realview.o spitz.o stellaris.o >> obj-y += tosa.o versatilepb.o vexpress.o xilinx_zynq.o z2.o >> >> obj-y += armv7m.o exynos4210.o pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o >> -obj-y += omap1.o omap2.o strongarm.o allwinner-a10.o >> +obj-y += omap1.o omap2.o strongarm.o allwinner-a10.o cubieboard.o >> diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c >> new file mode 100644 >> index 0000000..a5be21c >> --- /dev/null >> +++ b/hw/arm/cubieboard.c >> @@ -0,0 +1,33 @@ >> +#include "hw/sysbus.h" >> +#include "hw/devices.h" >> +#include "hw/boards.h" >> +#include "hw/arm/allwinner-a10.h" >> + >> + >> +static struct arm_boot_info cubieboard_binfo = { >> + .loader_start = A10_SDRAM_BASE, >> + .board_id = 0x1008, >> +}; >> + >> +static void cubieboard_init(QEMUMachineInitArgs *args) >> +{ >> + A10State *s = a10_init(get_system_memory(), args->ram_size); >> + >> + cubieboard_binfo.ram_size = args->ram_size; >> + cubieboard_binfo.kernel_filename = args->kernel_filename; >> + cubieboard_binfo.kernel_cmdline = args->kernel_cmdline; >> > I cant help but think that serial attachment needs to happen on the > board level. but im not sure how this can be made to work with the > un-qomified serial_mm_init, so no block from me unless Andreas has a > better idea. > > >> + arm_load_kernel(s->cpu,&cubieboard_binfo); >> +} >> + >> +static QEMUMachine cubieboard_machine = { >> + .name = "cubieboard", >> + .init = cubieboard_init, >> > I think you should add at least the long descriptor so -M help plays nice. > > OK, thanks!
Andreas Färber wrote: > Am 03.12.2013 13:01, schrieb Peter Crosthwaite: > >> On Tue, Dec 3, 2013 at 7:11 PM, liguang<lig.fnst@cn.fujitsu.com> wrote: >> >>> Signed-off-by: liguang<lig.fnst@cn.fujitsu.com> >>> --- >>> hw/arm/Makefile.objs | 2 +- >>> hw/arm/cubieboard.c | 33 +++++++++++++++++++++++++++++++++ >>> 2 files changed, 34 insertions(+), 1 deletions(-) >>> create mode 100644 hw/arm/cubieboard.c >>> >>> diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs >>> index b9e5983..8be8d8e 100644 >>> --- a/hw/arm/Makefile.objs >>> +++ b/hw/arm/Makefile.objs >>> @@ -4,4 +4,4 @@ obj-y += omap_sx1.o palm.o realview.o spitz.o stellaris.o >>> obj-y += tosa.o versatilepb.o vexpress.o xilinx_zynq.o z2.o >>> >>> obj-y += armv7m.o exynos4210.o pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o >>> -obj-y += omap1.o omap2.o strongarm.o allwinner-a10.o >>> +obj-y += omap1.o omap2.o strongarm.o allwinner-a10.o cubieboard.o >>> diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c >>> new file mode 100644 >>> index 0000000..a5be21c >>> --- /dev/null >>> +++ b/hw/arm/cubieboard.c >>> @@ -0,0 +1,33 @@ >>> +#include "hw/sysbus.h" >>> +#include "hw/devices.h" >>> +#include "hw/boards.h" >>> +#include "hw/arm/allwinner-a10.h" >>> + >>> + >>> +static struct arm_boot_info cubieboard_binfo = { >>> + .loader_start = A10_SDRAM_BASE, >>> + .board_id = 0x1008, >>> +}; >>> + >>> +static void cubieboard_init(QEMUMachineInitArgs *args) >>> +{ >>> + A10State *s = a10_init(get_system_memory(), args->ram_size); >>> + >>> + cubieboard_binfo.ram_size = args->ram_size; >>> + cubieboard_binfo.kernel_filename = args->kernel_filename; >>> + cubieboard_binfo.kernel_cmdline = args->kernel_cmdline; >>> >> I cant help but think that serial attachment needs to happen on the >> board level. but im not sure how this can be made to work with the >> un-qomified serial_mm_init, so no block from me unless Andreas has a >> better idea. >> > I don't have an immediate solution, same problem in Tegra2 code. > > If someone is willing to convert serial_mm into QOM-friendly form that > would be nice but I will be unavailable for review the next ~two weeks. > > What I do wonder here is why this is calling a new a10_init() rather > than object_new() and related QOM APIs. get_system_memory() can without > problems be called inside the device. If RAM is really on the SoC (it is > for Tegra2/3) then it could become a property of the device with > MemoryRegion initialization in realize - that is still unclean in my > code IIRC. > > >>> + arm_load_kernel(s->cpu,&cubieboard_binfo); >>> +} >>> > [...] > >>> +machine_init(cubieboard_machine_init); >>> > No semicolon here please, it's a function. > > Yes, thanks!
diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs index b9e5983..8be8d8e 100644 --- a/hw/arm/Makefile.objs +++ b/hw/arm/Makefile.objs @@ -4,4 +4,4 @@ obj-y += omap_sx1.o palm.o realview.o spitz.o stellaris.o obj-y += tosa.o versatilepb.o vexpress.o xilinx_zynq.o z2.o obj-y += armv7m.o exynos4210.o pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o -obj-y += omap1.o omap2.o strongarm.o allwinner-a10.o +obj-y += omap1.o omap2.o strongarm.o allwinner-a10.o cubieboard.o diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c new file mode 100644 index 0000000..a5be21c --- /dev/null +++ b/hw/arm/cubieboard.c @@ -0,0 +1,33 @@ +#include "hw/sysbus.h" +#include "hw/devices.h" +#include "hw/boards.h" +#include "hw/arm/allwinner-a10.h" + + +static struct arm_boot_info cubieboard_binfo = { + .loader_start = A10_SDRAM_BASE, + .board_id = 0x1008, +}; + +static void cubieboard_init(QEMUMachineInitArgs *args) +{ + A10State *s = a10_init(get_system_memory(), args->ram_size); + + cubieboard_binfo.ram_size = args->ram_size; + cubieboard_binfo.kernel_filename = args->kernel_filename; + cubieboard_binfo.kernel_cmdline = args->kernel_cmdline; + arm_load_kernel(s->cpu, &cubieboard_binfo); +} + +static QEMUMachine cubieboard_machine = { + .name = "cubieboard", + .init = cubieboard_init, +}; + + +static void cubieboard_machine_init(void) +{ + qemu_register_machine(&cubieboard_machine); +} + +machine_init(cubieboard_machine_init);
Signed-off-by: liguang <lig.fnst@cn.fujitsu.com> --- hw/arm/Makefile.objs | 2 +- hw/arm/cubieboard.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletions(-) create mode 100644 hw/arm/cubieboard.c