diff mbox

powerpc/e500: move qemu machine spec together with the rest

Message ID 55E992AE.3010605@freescale.com
State Not Applicable
Headers show

Commit Message

Tudor Laurentiu Sept. 4, 2015, 12:46 p.m. UTC
This way we get rid of an entire file with mostly
duplicated code plus a Kconfig option that you always
had to take care to check it in order for kvm to work.

Signed-off-by: Laurentiu Tudor <Laurentiu.Tudor@freescale.com>
---
 arch/powerpc/platforms/85xx/Kconfig           | 15 -----
 arch/powerpc/platforms/85xx/Makefile          |  1 -
 arch/powerpc/platforms/85xx/corenet_generic.c |  1 +
 arch/powerpc/platforms/85xx/qemu_e500.c       | 85 ---------------------------
 4 files changed, 1 insertion(+), 101 deletions(-)
 delete mode 100644 arch/powerpc/platforms/85xx/qemu_e500.c

Comments

Scott Wood Sept. 9, 2015, 11:01 p.m. UTC | #1
On Fri, 2015-09-04 at 15:46 +0300, Laurentiu Tudor wrote:
> This way we get rid of an entire file with mostly
> duplicated code plus a Kconfig option that you always
> had to take care to check it in order for kvm to work.
> 
> Signed-off-by: Laurentiu Tudor <Laurentiu.Tudor@freescale.com>
> ---
>  arch/powerpc/platforms/85xx/Kconfig           | 15 -----
>  arch/powerpc/platforms/85xx/Makefile          |  1 -
>  arch/powerpc/platforms/85xx/corenet_generic.c |  1 +
>  arch/powerpc/platforms/85xx/qemu_e500.c       | 85 ------------------------


qemu_e500 is not only for corenet chips.  We can add it to the defconfig (in 
fact I've been meaning to do so).

> -static void __init qemu_e500_setup_arch(void)
> -{
> -     ppc_md.progress("qemu_e500_setup_arch()", 0);
> -
> -     fsl_pci_assign_primary();
> -     swiotlb_detect_4g();

Where is fsl_pci_assign_primary() in corenet_generic.c?  At one point this 
was needed for QEMU's PCI implementation -- have you tested QEMU PCI without 
it?

-Scott

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tudor Laurentiu Sept. 14, 2015, 1:17 p.m. UTC | #2
On 09/10/2015 02:01 AM, Scott Wood wrote:
> On Fri, 2015-09-04 at 15:46 +0300, Laurentiu Tudor wrote:
>> This way we get rid of an entire file with mostly
>> duplicated code plus a Kconfig option that you always
>> had to take care to check it in order for kvm to work.
>>
>> Signed-off-by: Laurentiu Tudor <Laurentiu.Tudor@freescale.com>
>> ---
>>  arch/powerpc/platforms/85xx/Kconfig           | 15 -----
>>  arch/powerpc/platforms/85xx/Makefile          |  1 -
>>  arch/powerpc/platforms/85xx/corenet_generic.c |  1 +
>>  arch/powerpc/platforms/85xx/qemu_e500.c       | 85 ------------------------
> 
> 
> qemu_e500 is not only for corenet chips.  

That's too bad. :-(
I remember discussions on dropping the e500v2 support at some point in time?

> We can add it to the defconfig (in fact I've been meaning to do so).

Or maybe just drop de KConfig option and
wrap the file in an #ifdef CONFIG_KVM or something along these lines?
 
>> -static void __init qemu_e500_setup_arch(void)
>> -{
>> -     ppc_md.progress("qemu_e500_setup_arch()", 0);
>> -
>> -     fsl_pci_assign_primary();
>> -     swiotlb_detect_4g();
> 
> Where is fsl_pci_assign_primary() in corenet_generic.c?  

This commit claims it's not needed and drops it:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=7d4d595dad30328bc6153e235d90f54c918fc127

> At one point this 
> was needed for QEMU's PCI implementation -- have you tested QEMU PCI without 
> it?

Well, somehow i've (embarrassingly) messed up my initial tests.
I've retested after seeing your comment and indeed this breaks pci under qemu.
Adding to the confusion, the commit above made me think that the removal was safe.
Why pci qemu doesn't work without the call to fsl_pci_assign_primary() is
an interesting subject.

---
Best Regards, Laurentiu


--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alexander Graf Sept. 14, 2015, 2:14 p.m. UTC | #3
> Am 14.09.2015 um 15:17 schrieb Laurentiu Tudor <b10716@freescale.com>:
> 
>> On 09/10/2015 02:01 AM, Scott Wood wrote:
>>> On Fri, 2015-09-04 at 15:46 +0300, Laurentiu Tudor wrote:
>>> This way we get rid of an entire file with mostly
>>> duplicated code plus a Kconfig option that you always
>>> had to take care to check it in order for kvm to work.
>>> 
>>> Signed-off-by: Laurentiu Tudor <Laurentiu.Tudor@freescale.com>
>>> ---
>>> arch/powerpc/platforms/85xx/Kconfig           | 15 -----
>>> arch/powerpc/platforms/85xx/Makefile          |  1 -
>>> arch/powerpc/platforms/85xx/corenet_generic.c |  1 +
>>> arch/powerpc/platforms/85xx/qemu_e500.c       | 85 ------------------------
>> 
>> 
>> qemu_e500 is not only for corenet chips.  
> 
> That's too bad. :-(
> I remember discussions on dropping the e500v2 support at some point in time?
> 
>> We can add it to the defconfig (in fact I've been meaning to do so).
> 
> Or maybe just drop de KConfig option and
> wrap the file in an #ifdef CONFIG_KVM or something along these lines?

CONFIG_KVM is for host support though. This is for the guest kernel.

Alex

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Scott Wood Sept. 14, 2015, 3:09 p.m. UTC | #4
On Mon, 2015-09-14 at 16:14 +0200, Alexander Graf wrote:
> > Am 14.09.2015 um 15:17 schrieb Laurentiu Tudor <b10716@freescale.com>:
> > 
> > > On 09/10/2015 02:01 AM, Scott Wood wrote:
> > > > On Fri, 2015-09-04 at 15:46 +0300, Laurentiu Tudor wrote:
> > > > This way we get rid of an entire file with mostly
> > > > duplicated code plus a Kconfig option that you always
> > > > had to take care to check it in order for kvm to work.
> > > > 
> > > > Signed-off-by: Laurentiu Tudor <Laurentiu.Tudor@freescale.com>
> > > > ---
> > > > arch/powerpc/platforms/85xx/Kconfig           | 15 -----
> > > > arch/powerpc/platforms/85xx/Makefile          |  1 -
> > > > arch/powerpc/platforms/85xx/corenet_generic.c |  1 +
> > > > arch/powerpc/platforms/85xx/qemu_e500.c       | 85 -------------------
> > > > -----
> > > 
> > > 
> > > qemu_e500 is not only for corenet chips.  
> > 
> > That's too bad. :-(
> > I remember discussions on dropping the e500v2 support at some point in 
> > time?
> > 
> > > We can add it to the defconfig (in fact I've been meaning to do so).
> > 
> > Or maybe just drop de KConfig option and
> > wrap the file in an #ifdef CONFIG_KVM or something along these lines?
> 
> CONFIG_KVM is for host support though. This is for the guest kernel.

CONFIG_QEMU_E500 can also be used with TCG -- it's not KVM-specific.

-Scott

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Scott Wood Sept. 14, 2015, 3:11 p.m. UTC | #5
On Mon, 2015-09-14 at 16:17 +0300, Laurentiu Tudor wrote:
> On 09/10/2015 02:01 AM, Scott Wood wrote:
> > On Fri, 2015-09-04 at 15:46 +0300, Laurentiu Tudor wrote:
> > > This way we get rid of an entire file with mostly
> > > duplicated code plus a Kconfig option that you always
> > > had to take care to check it in order for kvm to work.
> > > 
> > > Signed-off-by: Laurentiu Tudor <Laurentiu.Tudor@freescale.com>
> > > ---
> > >  arch/powerpc/platforms/85xx/Kconfig           | 15 -----
> > >  arch/powerpc/platforms/85xx/Makefile          |  1 -
> > >  arch/powerpc/platforms/85xx/corenet_generic.c |  1 +
> > >  arch/powerpc/platforms/85xx/qemu_e500.c       | 85 --------------------
> > > ----
> > 
> > 
> > qemu_e500 is not only for corenet chips.  
> 
> That's too bad. :-(
> I remember discussions on dropping the e500v2 support at some point in time?
> 
> > We can add it to the defconfig (in fact I've been meaning to do so).
> 
> Or maybe just drop de KConfig option and
> wrap the file in an #ifdef CONFIG_KVM or something along these lines?
>  
> > > -static void __init qemu_e500_setup_arch(void)
> > > -{
> > > -     ppc_md.progress("qemu_e500_setup_arch()", 0);
> > > -
> > > -     fsl_pci_assign_primary();
> > > -     swiotlb_detect_4g();
> > 
> > Where is fsl_pci_assign_primary() in corenet_generic.c?  
> 
> This commit claims it's not needed and drops it:
> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=7d4d595dad30328bc6153e235d90f54c918fc127

That commit has nothing to do with QEMU.

> > At one point this 
> > was needed for QEMU's PCI implementation -- have you tested QEMU PCI 
> > without 
> > it?
> 
> Well, somehow i've (embarrassingly) messed up my initial tests.
> I've retested after seeing your comment and indeed this breaks pci under 
> qemu.
> Adding to the confusion, the commit above made me think that the removal 
> was safe.
> Why pci qemu doesn't work without the call to fsl_pci_assign_primary() is
> an interesting subject.

IIRC it has to do with QEMU not liking a BAR set to zero.

-Scott


--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index 97915fe..0c1ce10 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -249,21 +249,6 @@  config MVME2500
 
 endif # PPC32
 
-config PPC_QEMU_E500
-	bool "QEMU generic e500 platform"
-	select DEFAULT_UIMAGE
-	help
-	  This option enables support for running as a QEMU guest using
-	  QEMU's generic e500 machine.  This is not required if you're
-	  using a QEMU machine that targets a specific board, such as
-	  mpc8544ds.
-
-	  Unlike most e500 boards that target a specific CPU, this
-	  platform works with any e500-family CPU that QEMU supports.
-	  Thus, you'll need to make sure CONFIG_PPC_E500MC is set or
-	  unset based on the emulated CPU (or actual host CPU in the case
-	  of KVM).
-
 config CORENET_GENERIC
 	bool "Freescale CoreNet Generic"
 	select DEFAULT_UIMAGE
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index 1fe7fb9..33fbfb8 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -29,6 +29,5 @@  obj-$(CONFIG_SOCRATES)    += socrates.o socrates_fpga_pic.o
 obj-$(CONFIG_KSI8560)	  += ksi8560.o
 obj-$(CONFIG_XES_MPC85xx) += xes_mpc85xx.o
 obj-$(CONFIG_GE_IMP3A)	  += ge_imp3a.o
-obj-$(CONFIG_PPC_QEMU_E500) += qemu_e500.o
 obj-$(CONFIG_SGY_CTS1000) += sgy_cts1000.o
 obj-$(CONFIG_MVME2500)	  += mvme2500.o
diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c b/arch/powerpc/platforms/85xx/corenet_generic.c
index bd839dc..85078ee 100644
--- a/arch/powerpc/platforms/85xx/corenet_generic.c
+++ b/arch/powerpc/platforms/85xx/corenet_generic.c
@@ -159,6 +159,7 @@  static const char * const boards[] __initconst = {
 	"fsl,T1042RDB",
 	"fsl,T1042RDB_PI",
 	"keymile,kmcoge4",
+	"fsl,qemu-e500",
 	NULL
 };
 
diff --git a/arch/powerpc/platforms/85xx/qemu_e500.c b/arch/powerpc/platforms/85xx/qemu_e500.c
deleted file mode 100644
index 8ad2fe6..0000000
--- a/arch/powerpc/platforms/85xx/qemu_e500.c
+++ /dev/null
@@ -1,85 +0,0 @@ 
-/*
- * Paravirt target for a generic QEMU e500 machine
- *
- * This is intended to be a flexible device-tree-driven platform, not fixed
- * to a particular piece of hardware or a particular spec of virtual hardware,
- * beyond the assumption of an e500-family CPU.  Some things are still hardcoded
- * here, such as MPIC, but this is a limitation of the current code rather than
- * an interface contract with QEMU.
- *
- * Copyright 2012 Freescale Semiconductor Inc.
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- */
-
-#include <linux/kernel.h>
-#include <linux/of_fdt.h>
-#include <asm/machdep.h>
-#include <asm/pgtable.h>
-#include <asm/time.h>
-#include <asm/udbg.h>
-#include <asm/mpic.h>
-#include <sysdev/fsl_soc.h>
-#include <sysdev/fsl_pci.h>
-#include "smp.h"
-#include "mpc85xx.h"
-
-void __init qemu_e500_pic_init(void)
-{
-	struct mpic *mpic;
-	unsigned int flags = MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU |
-		MPIC_ENABLE_COREINT;
-
-	mpic = mpic_alloc(NULL, 0, flags, 0, 256, " OpenPIC  ");
-
-	BUG_ON(mpic == NULL);
-	mpic_init(mpic);
-}
-
-static void __init qemu_e500_setup_arch(void)
-{
-	ppc_md.progress("qemu_e500_setup_arch()", 0);
-
-	fsl_pci_assign_primary();
-	swiotlb_detect_4g();
-#if defined(CONFIG_FSL_PCI) && defined(CONFIG_ZONE_DMA32)
-	/*
-	 * Inbound windows don't cover the full lower 4 GiB
-	 * due to conflicts with PCICSRBAR and outbound windows,
-	 * so limit the DMA32 zone to 2 GiB, to allow consistent
-	 * allocations to succeed.
-	 */
-	limit_zone_pfn(ZONE_DMA32, 1UL << (31 - PAGE_SHIFT));
-#endif
-	mpc85xx_smp_init();
-}
-
-/*
- * Called very early, device-tree isn't unflattened
- */
-static int __init qemu_e500_probe(void)
-{
-	unsigned long root = of_get_flat_dt_root();
-
-	return !!of_flat_dt_is_compatible(root, "fsl,qemu-e500");
-}
-
-machine_arch_initcall(qemu_e500, mpc85xx_common_publish_devices);
-
-define_machine(qemu_e500) {
-	.name			= "QEMU e500",
-	.probe			= qemu_e500_probe,
-	.setup_arch		= qemu_e500_setup_arch,
-	.init_IRQ		= qemu_e500_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
-#endif
-	.get_irq		= mpic_get_coreint_irq,
-	.restart		= fsl_rstcr_restart,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
-};