From: Scott Wood <hidden> Date: 2012-06-27 23:49:01
The QEMU stuff is related to the PCI refactoring because currently
we have a hard time selecting a primary bus under QEMU, and also because
the generic qemu e500 platform wants a full list of FSL PCI compatibles
to check.
Scott Wood (3):
powerpc/fsl-pci: get PCI init out of board files
powerpc/e500: add paravirt QEMU platform
powerpc/mpc85xx_ds: convert to unified PCI init
arch/powerpc/platforms/85xx/Kconfig | 16 +++++
arch/powerpc/platforms/85xx/Makefile | 1 +
arch/powerpc/platforms/85xx/mpc85xx_ds.c | 97 +++++++++---------------------
arch/powerpc/platforms/85xx/qemu_e500.c | 66 ++++++++++++++++++++
arch/powerpc/platforms/Kconfig.cputype | 4 +
arch/powerpc/sysdev/fsl_pci.c | 66 ++++++++++++++++++++
arch/powerpc/sysdev/fsl_pci.h | 8 +++
7 files changed, 190 insertions(+), 68 deletions(-)
create mode 100644 arch/powerpc/platforms/85xx/qemu_e500.c
--
1.7.5.4
From: Scott Wood <hidden> Date: 2012-06-27 23:50:14
As an alternative incremental starting point to Jia Hongtao's patchset,
get the FSL PCI init out of the board files, but do not yet convert to a
platform driver.
Rather than having each board supply a magic register offset for
determining the "primary" bus, we look for which PCI host bridge
contains an ISA node within its subtree. If there is no ISA node,
normally that would mean there is no primary bus, but until certain
bugs are fixed we arbitrarily designate a primary in this case.
Conversion to a platform driver and related improvements can happen
after this, as the ordering issues are sorted out.
Signed-off-by: Scott Wood <redacted>
---
arch/powerpc/sysdev/fsl_pci.c | 66 +++++++++++++++++++++++++++++++++++++++++
arch/powerpc/sysdev/fsl_pci.h | 8 +++++
2 files changed, 74 insertions(+), 0 deletions(-)
@@ -807,3 +807,69 @@ u64 fsl_pci_immrbar_base(struct pci_controller *hose)return0;}++#if defined(CONFIG_FSL_SOC_BOOKE) || defined(CONFIG_PPC_86xx)+staticconststructof_device_idpci_ids[]={+{.compatible="fsl,mpc8540-pci",},+{.compatible="fsl,mpc8548-pcie",},+{.compatible="fsl,mpc8610-pci",},+{.compatible="fsl,mpc8641-pcie",},+{.compatible="fsl,p1022-pcie",},+{.compatible="fsl,p1010-pcie",},+{.compatible="fsl,p1023-pcie",},+{.compatible="fsl,p4080-pcie",},+{.compatible="fsl,qoriq-pcie-v2.3",},+{.compatible="fsl,qoriq-pcie-v2.2",},+{},+};++structdevice_node*fsl_pci_primary;++void__devinitfsl_pci_init(void)+{+structdevice_node*node;+structpci_controller*hose;+dma_addr_tmax=0xffffffff;++/* If a PCI host bridge has an ISA node under it, it's primary. */+node=of_find_node_by_type(NULL,"isa");+while((fsl_pci_primary=of_get_parent(node))){+of_node_put(node);+node=fsl_pci_primary;++if(of_match_node(pci_ids,node))+break;+}++node=NULL;+for_each_node_by_type(node,"pci"){+if(of_match_node(pci_ids,node)){+/*+*Ifthere'snoPCIhostbridgewithISA,arbitrarily+*designateoneasprimary.Thiscangoawayonce+*variousbugswithprimary-lesssystemsarefixed.+*/+if(!fsl_pci_primary)+fsl_pci_primary=node;++fsl_add_bridge(node,fsl_pci_primary==node);+hose=pci_find_hose_for_OF_device(node);+max=min(max,hose->dma_window_base_cur++hose->dma_window_size);+}+}++#ifdef CONFIG_SWIOTLB+/*+*ifwecouldn'tmapallofDRAMviathedmawindows+*weneedSWIOTLBtohandlebufferslocatedoutsideof+*dmacapablememoryregion+*/+if(memblock_end_of_DRAM()-1>max){+ppc_swiotlb_enable=1;+set_pci_dma_ops(&swiotlb_dma_ops);+ppc_md.pci_dma_dev_setup=pci_dma_dev_setup_swiotlb;+}+#endif+}+#endif
From: Scott Wood <hidden> Date: 2012-06-27 23:50:16
This gives the kernel a paravirtualized machine to target, without
requiring both sides to pretend to be targeting a specific board
that likely has little to do with the host in KVM scenarios. This
avoids the need to add new boards to QEMU just to be able to
run KVM on new CPUs.
As this is the first platform that can run with either e500v2 or
e500mc, CONFIG_PPC_E500MC is now a legitimately user configurable
option, so add a help text.
Signed-off-by: Scott Wood <redacted>
---
arch/powerpc/platforms/85xx/Kconfig | 16 +++++++
arch/powerpc/platforms/85xx/Makefile | 1 +
arch/powerpc/platforms/85xx/qemu_e500.c | 66 +++++++++++++++++++++++++++++++
arch/powerpc/platforms/Kconfig.cputype | 4 ++
4 files changed, 87 insertions(+), 0 deletions(-)
create mode 100644 arch/powerpc/platforms/85xx/qemu_e500.c
From: Scott Wood <hidden> Date: 2012-06-27 23:50:17
Similar to how the primary PCI bridge is identified by looking
for an isa subnode, we determine whether to apply uli exclusions
by looking for a uli subnode.
Signed-off-by: Scott Wood <redacted>
---
Besides being an example of a real-hardware board to use the new PCI init
(probably one of the more complicated examples due to the uli device
exclusion), this fixes PCI under QEMU's mpc8544ds machine. QEMU was
only creating one PCI bus, and it wasn't the one Linux had arbitrarily
deemed primary for mpc8544ds (AFAIK, there's no legacy ISA on this
board).
Tested with QEMU mpc8544ds, and real-hardware mpc8572ds (with uli).
arch/powerpc/platforms/85xx/mpc85xx_ds.c | 97 +++++++++---------------------
1 files changed, 29 insertions(+), 68 deletions(-)
@@ -114,71 +114,53 @@ void __init mpc85xx_ds_pic_init(void)}#ifdef CONFIG_PCI-staticintprimary_phb_addr;externintuli_exclude_device(structpci_controller*hose,u_charbus,u_chardevfn);+staticstructdevice_node*pci_with_uli;+staticintmpc85xx_exclude_device(structpci_controller*hose,u_charbus,u_chardevfn){-structdevice_node*node;-structresourcersrc;--node=hose->dn;-of_address_to_resource(node,0,&rsrc);--if((rsrc.start&0xfffff)==primary_phb_addr){+if(hose->dn==pci_with_uli)returnuli_exclude_device(hose,bus,devfn);-}returnPCIBIOS_SUCCESSFUL;}#endif /* CONFIG_PCI */-/*-*Setupthearchitecture-*/-staticvoid__initmpc85xx_ds_setup_arch(void)+staticvoid__initmpc85xx_ds_pci_init(void){#ifdef CONFIG_PCI-structdevice_node*np;-structpci_controller*hose;-#endif-dma_addr_tmax=0xffffffff;+structdevice_node*node;-if(ppc_md.progress)-ppc_md.progress("mpc85xx_ds_setup_arch()",0);+fsl_pci_init();-#ifdef CONFIG_PCI-for_each_node_by_type(np,"pci"){-if(of_device_is_compatible(np,"fsl,mpc8540-pci")||-of_device_is_compatible(np,"fsl,mpc8548-pcie")||-of_device_is_compatible(np,"fsl,p2020-pcie")){-structresourcersrc;-of_address_to_resource(np,0,&rsrc);-if((rsrc.start&0xfffff)==primary_phb_addr)-fsl_add_bridge(np,1);-else-fsl_add_bridge(np,0);--hose=pci_find_hose_for_OF_device(np);-max=min(max,hose->dma_window_base_cur+-hose->dma_window_size);+/* See if we have a ULI under the primary */++node=of_find_node_by_name(NULL,"uli1575");+while((pci_with_uli=of_get_parent(node))){+of_node_put(node);+node=pci_with_uli;++if(pci_with_uli==fsl_pci_primary){+ppc_md.pci_exclude_device=mpc85xx_exclude_device;+break;}}--ppc_md.pci_exclude_device=mpc85xx_exclude_device;#endif+}-mpc85xx_smp_init();+/*+*Setupthearchitecture+*/+staticvoid__initmpc85xx_ds_setup_arch(void)+{+if(ppc_md.progress)+ppc_md.progress("mpc85xx_ds_setup_arch()",0);-#ifdef CONFIG_SWIOTLB-if(memblock_end_of_DRAM()>max){-ppc_swiotlb_enable=1;-set_pci_dma_ops(&swiotlb_dma_ops);-ppc_md.pci_dma_dev_setup=pci_dma_dev_setup_swiotlb;-}-#endif+mpc85xx_ds_pci_init();+mpc85xx_smp_init();printk("MPC85xx DS board from Freescale Semiconductor\n");}
@@ -190,14 +172,7 @@ static int __init mpc8544_ds_probe(void){unsignedlongroot=of_get_flat_dt_root();-if(of_flat_dt_is_compatible(root,"MPC8544DS")){-#ifdef CONFIG_PCI-primary_phb_addr=0xb000;-#endif-return1;-}--return0;+return!!of_flat_dt_is_compatible(root,"MPC8544DS");}machine_device_initcall(mpc8544_ds,mpc85xx_common_publish_devices);
@@ -215,14 +190,7 @@ static int __init mpc8572_ds_probe(void){unsignedlongroot=of_get_flat_dt_root();-if(of_flat_dt_is_compatible(root,"fsl,MPC8572DS")){-#ifdef CONFIG_PCI-primary_phb_addr=0x8000;-#endif-return1;-}--return0;+return!!of_flat_dt_is_compatible(root,"fsl,MPC8572DS");}/*
@@ -232,14 +200,7 @@ static int __init p2020_ds_probe(void){unsignedlongroot=of_get_flat_dt_root();-if(of_flat_dt_is_compatible(root,"fsl,P2020DS")){-#ifdef CONFIG_PCI-primary_phb_addr=0x9000;-#endif-return1;-}--return0;+return!!of_flat_dt_is_compatible(root,"fsl,P2020DS");}define_machine(mpc8544_ds){
-----Original Message-----
From: Wood Scott-B07421
Sent: Thursday, June 28, 2012 7:49 AM
To: galak@kernel.crashing.org
Cc: agraf@suse.de; linuxppc-dev@lists.ozlabs.org; Jia Hongtao-B38951
Subject: [PATCH 0/3] powerpc/fsl: PCI refactoring and QEMU paravirt
platform
=20
The QEMU stuff is related to the PCI refactoring because currently
we have a hard time selecting a primary bus under QEMU, and also because
the generic qemu e500 platform wants a full list of FSL PCI compatibles
to check.
=20
It seems that not all primary bus has "isa" node like 8541 and 8555.
Without PM support for pci controllers I totally agree with this refactorin=
g
for pci init. But in linux mechanism PM ops should be registered to a drive=
r.
Do you have any ideas to add PM support for pci controllers under this patc=
hset?
Thanks.
-Jia Hongtao.
From: Scott Wood <hidden> Date: 2012-06-28 16:32:00
On 06/27/2012 11:06 PM, Jia Hongtao-B38951 wrote:
quoted
-----Original Message-----
From: Wood Scott-B07421
Sent: Thursday, June 28, 2012 7:49 AM
To: galak@kernel.crashing.org
Cc: agraf@suse.de; linuxppc-dev@lists.ozlabs.org; Jia Hongtao-B38951
Subject: [PATCH 0/3] powerpc/fsl: PCI refactoring and QEMU paravirt
platform
The QEMU stuff is related to the PCI refactoring because currently
we have a hard time selecting a primary bus under QEMU, and also because
the generic qemu e500 platform wants a full list of FSL PCI compatibles
to check.
It seems that not all primary bus has "isa" node like 8541 and 8555.
Do those boards (it's the boards that matter, not chips...) have legacy
ISA? If they do, and it's not in the device tree, then we should fix
the device tree for consistency, but also retain some sort of hack to
remain compatible with old device trees.
A board can refrain from using the new common infrastructure if it has a
good reason to.
Without PM support for pci controllers I totally agree with this refactoring
for pci init. But in linux mechanism PM ops should be registered to a driver.
Do you have any ideas to add PM support for pci controllers under this patchset?
This isn't meant to be instead of making it a platform device. It's
just meant to get us away from board-specific code and primary-bus
hardcoding now, rather than once we sort out all the issues with
platform devices.
-Scott
From: Kumar Gala <hidden> Date: 2012-06-29 15:57:44
On Jun 28, 2012, at 9:36 PM, Jia Hongtao-B38951 wrote:
=20
=20
quoted
-----Original Message-----
From: Wood Scott-B07421
Sent: Friday, June 29, 2012 12:31 AM
To: Jia Hongtao-B38951
Cc: Wood Scott-B07421; galak@kernel.crashing.org; Li Yang-R58472;
agraf@suse.de; linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 0/3] powerpc/fsl: PCI refactoring and QEMU =
paravirt
quoted
platform
=20
On 06/27/2012 11:06 PM, Jia Hongtao-B38951 wrote:
quoted
=20
=20
quoted
-----Original Message-----
From: Wood Scott-B07421
Sent: Thursday, June 28, 2012 7:49 AM
To: galak@kernel.crashing.org
Cc: agraf@suse.de; linuxppc-dev@lists.ozlabs.org; Jia =
Hongtao-B38951
quoted
quoted
quoted
Subject: [PATCH 0/3] powerpc/fsl: PCI refactoring and QEMU paravirt
platform
=20
The QEMU stuff is related to the PCI refactoring because currently
we have a hard time selecting a primary bus under QEMU, and also
because
quoted
quoted
the generic qemu e500 platform wants a full list of FSL PCI
compatibles
quoted
quoted
to check.
=20
=20
It seems that not all primary bus has "isa" node like 8541 and 8555.
=20
Do those boards (it's the boards that matter, not chips...) have =
legacy
quoted
ISA? If they do, and it's not in the device tree, then we should fix
the device tree for consistency, but also retain some sort of hack to
remain compatible with old device trees.
=20
A board can refrain from using the new common infrastructure if it =
has a
quoted
good reason to.
=20
I'm not sure that MPC8541CDS (or 8555) has legacy ISA. I just checked =
in
kernel and dts which implies the board has primary bus and no "isa" =
node.
I will find out the facts later.
Pretty sure the boards have ISA, if you see the .dts has references to =
'ISA bridge' & 'i8259' PIC.
- k
From: Scott Wood <hidden> Date: 2012-06-29 16:02:00
On 06/29/2012 10:57 AM, Kumar Gala wrote:
On Jun 28, 2012, at 9:36 PM, Jia Hongtao-B38951 wrote:
quoted
quoted
-----Original Message-----
From: Wood Scott-B07421
Sent: Friday, June 29, 2012 12:31 AM
To: Jia Hongtao-B38951
Cc: Wood Scott-B07421; galak@kernel.crashing.org; Li Yang-R58472;
agraf@suse.de; linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 0/3] powerpc/fsl: PCI refactoring and QEMU paravirt
platform
On 06/27/2012 11:06 PM, Jia Hongtao-B38951 wrote:
quoted
quoted
-----Original Message-----
From: Wood Scott-B07421
Sent: Thursday, June 28, 2012 7:49 AM
To: galak@kernel.crashing.org
Cc: agraf@suse.de; linuxppc-dev@lists.ozlabs.org; Jia Hongtao-B38951
Subject: [PATCH 0/3] powerpc/fsl: PCI refactoring and QEMU paravirt
platform
The QEMU stuff is related to the PCI refactoring because currently
we have a hard time selecting a primary bus under QEMU, and also
because
quoted
quoted
the generic qemu e500 platform wants a full list of FSL PCI
compatibles
quoted
quoted
to check.
It seems that not all primary bus has "isa" node like 8541 and 8555.
Do those boards (it's the boards that matter, not chips...) have legacy
ISA? If they do, and it's not in the device tree, then we should fix
the device tree for consistency, but also retain some sort of hack to
remain compatible with old device trees.
A board can refrain from using the new common infrastructure if it has a
good reason to.
I'm not sure that MPC8541CDS (or 8555) has legacy ISA. I just checked in
kernel and dts which implies the board has primary bus and no "isa" node.
I will find out the facts later.
Pretty sure the boards have ISA, if you see the .dts has references to 'ISA bridge' & 'i8259' PIC.
OK. How about looking for an i8259 node as well?
-Scott
-----Original Message-----
From: Linuxppc-dev [mailto:linuxppc-dev-bounces+tie-
fei.zang=3Dfreescale.com@lists.ozlabs.org] On Behalf Of Kumar Gala
Sent: Friday, June 29, 2012 23:58 PM
To: Jia Hongtao-B38951
Cc: Wood Scott-B07421; linuxppc-dev@lists.ozlabs.org; Li Yang-R58472;
agraf@suse.de
Subject: Re: [PATCH 0/3] powerpc/fsl: PCI refactoring and QEMU paravirt
platform
=20
=20
On Jun 28, 2012, at 9:36 PM, Jia Hongtao-B38951 wrote:
=20
quoted
quoted
-----Original Message-----
From: Wood Scott-B07421
Sent: Friday, June 29, 2012 12:31 AM
To: Jia Hongtao-B38951
Cc: Wood Scott-B07421; galak@kernel.crashing.org; Li Yang-R58472;
agraf@suse.de; linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 0/3] powerpc/fsl: PCI refactoring and QEMU paravir=
t
quoted
quoted
platform
On 06/27/2012 11:06 PM, Jia Hongtao-B38951 wrote:
quoted
quoted
-----Original Message-----
From: Wood Scott-B07421
Sent: Thursday, June 28, 2012 7:49 AM
To: galak@kernel.crashing.org
Cc: agraf@suse.de; linuxppc-dev@lists.ozlabs.org; Jia Hongtao-B38951
Subject: [PATCH 0/3] powerpc/fsl: PCI refactoring and QEMU paravirt
platform
The QEMU stuff is related to the PCI refactoring because currently
we have a hard time selecting a primary bus under QEMU, and also
because
quoted
quoted
the generic qemu e500 platform wants a full list of FSL PCI
compatibles
quoted
quoted
to check.
It seems that not all primary bus has "isa" node like 8541 and 8555.
Do those boards (it's the boards that matter, not chips...) have legac=
y
quoted
quoted
ISA? If they do, and it's not in the device tree, then we should fix
the device tree for consistency, but also retain some sort of hack to
remain compatible with old device trees.
A board can refrain from using the new common infrastructure if it has=
a
quoted
quoted
good reason to.
I'm not sure that MPC8541CDS (or 8555) has legacy ISA. I just checked i=
n
quoted
kernel and dts which implies the board has primary bus and no "isa" nod=
e.
quoted
I will find out the facts later.
=20
Pretty sure the boards have ISA, if you see the .dts has references to 'I=
From: Scott Wood <hidden> Date: 2012-06-29 17:00:15
On 06/29/2012 11:18 AM, Li Yang-R58472 wrote:
quoted
-----Original Message----- From: Wood Scott-B07421 Sent: Friday,
June 29, 2012 11:02 AM To: Kumar Gala Cc: Jia Hongtao-B38951; Wood
Scott-B07421; Li Yang-R58472; agraf@suse.de;
linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH 0/3] powerpc/fsl:
PCI refactoring and QEMU paravirt platform
On 06/29/2012 10:57 AM, Kumar Gala wrote:
quoted
Pretty sure the boards have ISA, if you see the .dts has
references to
'ISA bridge' & 'i8259' PIC.
OK. How about looking for an i8259 node as well?
That could work, but looks hackish. Our proposal for adding a new
device tree property is a generic solution.
Yes, all *new* boards should have an isa node. But we want to remain
compatible with existing device trees.
The only problem is that
new kernels would work with old device trees. I think we can use
your solution for transitional period. And go for a well defined
device tree binding for this in long run.
The "transitional period" is until we no longer care about these
specific boards, or any out-of-tree derivatives.
-Scott
From: Alexander Graf <hidden> Date: 2012-07-06 12:29:24
On 28.06.2012, at 01:50, Scott Wood wrote:
This gives the kernel a paravirtualized machine to target, without
requiring both sides to pretend to be targeting a specific board
that likely has little to do with the host in KVM scenarios. This
avoids the need to add new boards to QEMU just to be able to
run KVM on new CPUs.
=20
As this is the first platform that can run with either e500v2 or
e500mc, CONFIG_PPC_E500MC is now a legitimately user configurable
option, so add a help text.
=20
Signed-off-by: Scott Wood <redacted>
---
arch/powerpc/platforms/85xx/Kconfig | 16 +++++++
arch/powerpc/platforms/85xx/Makefile | 1 +
arch/powerpc/platforms/85xx/qemu_e500.c | 66 =
+++++++++++++++++++++++++++++++
arch/powerpc/platforms/Kconfig.cputype | 4 ++
I really think we should document what exactly this machine expects.
help
This option enables support for the P5020 DS board
=20
+config PPC_QEMU_E500
+ bool "QEMU generic e500 platform"
+ depends on EXPERIMENTAL
+ 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
quoted hunk
+ of KVM).
+
endif # FSL_SOC_BOOKE
=20
config TQM85xx
Does that mean we're configuring the MPIC regardless of what the guest =
tells us? So the MPIC is a hard requirement. We can't use UIC or XPIC =
with this machine, right? This needs to be documented.
So the machine needs to be compatible "fsl,qemu-e500". Needs =
documentation in the machine spec.
I'm sure you'll find more constraints that appear logical, but really =
should be written down so we have something formal that potentially =
someone not-QEMU or not-Scott could write a machine implementation =
against ;).
Alex
From: Scott Wood <hidden> Date: 2012-07-06 16:25:18
On 07/06/2012 07:29 AM, Alexander Graf wrote:
On 28.06.2012, at 01:50, Scott Wood wrote:
quoted
This gives the kernel a paravirtualized machine to target, without
requiring both sides to pretend to be targeting a specific board
that likely has little to do with the host in KVM scenarios. This
avoids the need to add new boards to QEMU just to be able to
run KVM on new CPUs.
As this is the first platform that can run with either e500v2 or
e500mc, CONFIG_PPC_E500MC is now a legitimately user configurable
option, so add a help text.
Signed-off-by: Scott Wood <redacted>
---
arch/powerpc/platforms/85xx/Kconfig | 16 +++++++
arch/powerpc/platforms/85xx/Makefile | 1 +
arch/powerpc/platforms/85xx/qemu_e500.c | 66 +++++++++++++++++++++++++++++++
arch/powerpc/platforms/Kconfig.cputype | 4 ++
I really think we should document what exactly this machine expects.
Well, the point of this paravirt machine is to avoid such assumptions --
it's all device-tree driven, at least in theory. If a certain qemu
configuration ends up breaking the Linux platform (such as using a
different PIC), then that's a lack of flexibility on Linux's part that
should get fixed if someone finds it useful enough to justify the
effort. Same with real hardware -- if you care about it, you add
support -- we just don't have a unique name for every configuration.
The information is there in the device tree, though.
Honestly, even having "qemu" in there is more specific than I'd prefer,
but I don't want to stir up the "generic platform" argument again
without at least limiting the scope.
Does that mean we're configuring the MPIC regardless of what the
guest tells us? So the MPIC is a hard requirement. We can't use UIC
or XPIC with this machine, right? This needs to be documented.
Then what would we do if we want to add an ePAPR virtual PIC instead?
Or if something replaces MPIC on future FSL chips?
Better to change the Linux implementation as needed than to change a spec.
-Scott
From: Alexander Graf <hidden> Date: 2012-07-06 16:30:27
On 06.07.2012, at 18:25, Scott Wood wrote:
On 07/06/2012 07:29 AM, Alexander Graf wrote:
quoted
=20
On 28.06.2012, at 01:50, Scott Wood wrote:
=20
quoted
This gives the kernel a paravirtualized machine to target, without
requiring both sides to pretend to be targeting a specific board
that likely has little to do with the host in KVM scenarios. This
avoids the need to add new boards to QEMU just to be able to
run KVM on new CPUs.
=20
As this is the first platform that can run with either e500v2 or
e500mc, CONFIG_PPC_E500MC is now a legitimately user configurable
option, so add a help text.
=20
Signed-off-by: Scott Wood <redacted>
---
arch/powerpc/platforms/85xx/Kconfig | 16 +++++++
arch/powerpc/platforms/85xx/Makefile | 1 +
arch/powerpc/platforms/85xx/qemu_e500.c | 66 =
+++++++++++++++++++++++++++++++
quoted
quoted
arch/powerpc/platforms/Kconfig.cputype | 4 ++
=20
I really think we should document what exactly this machine expects.
=20
Well, the point of this paravirt machine is to avoid such assumptions =
--
it's all device-tree driven, at least in theory. If a certain qemu
configuration ends up breaking the Linux platform (such as using a
different PIC), then that's a lack of flexibility on Linux's part that
should get fixed if someone finds it useful enough to justify the
effort. Same with real hardware -- if you care about it, you add
support -- we just don't have a unique name for every configuration.
The information is there in the device tree, though.
=20
Honestly, even having "qemu" in there is more specific than I'd =
prefer,
but I don't want to stir up the "generic platform" argument again
without at least limiting the scope.
Well, can't we note down the assumptions we make to make sure that =
whoever develops an implementation of it knows what to implement? It's =
ppc specific for example. I also don't think that plugging a G3 in there =
works, would it?
=20
Does that mean we're configuring the MPIC regardless of what the
guest tells us? So the MPIC is a hard requirement. We can't use UIC
or XPIC with this machine, right? This needs to be documented.
=20
Then what would we do if we want to add an ePAPR virtual PIC instead?
Or if something replaces MPIC on future FSL chips?
Then we need a different compatible anyways, because we wouldn't be =
backwards compatible, no?
Better to change the Linux implementation as needed than to change a =
spec.
Why not keep the 2 in sync in the same patch? Just throw a file with a =
rough outline of the machine in Documentation/.
Alex
From: Scott Wood <hidden> Date: 2012-07-06 16:52:47
On 07/06/2012 11:30 AM, Alexander Graf wrote:
On 06.07.2012, at 18:25, Scott Wood wrote:
quoted
On 07/06/2012 07:29 AM, Alexander Graf wrote:
quoted
I really think we should document what exactly this machine expects.
Well, the point of this paravirt machine is to avoid such assumptions --
it's all device-tree driven, at least in theory. If a certain qemu
configuration ends up breaking the Linux platform (such as using a
different PIC), then that's a lack of flexibility on Linux's part that
should get fixed if someone finds it useful enough to justify the
effort. Same with real hardware -- if you care about it, you add
support -- we just don't have a unique name for every configuration.
The information is there in the device tree, though.
Honestly, even having "qemu" in there is more specific than I'd prefer,
but I don't want to stir up the "generic platform" argument again
without at least limiting the scope.
Well, can't we note down the assumptions we make to make sure that
whoever develops an implementation of it knows what to implement?
It's ppc specific for example. I also don't think that plugging a G3
in there works, would it?
Does that mean we're configuring the MPIC regardless of what the
guest tells us? So the MPIC is a hard requirement. We can't use UIC
or XPIC with this machine, right? This needs to be documented.
Then what would we do if we want to add an ePAPR virtual PIC instead?
Or if something replaces MPIC on future FSL chips?
Then we need a different compatible anyways, because we wouldn't be backwards compatible, no?
No, that's exactly what I'm trying to avoid. This notion of a toplevel
compatible that tells you everything you need to know about the machine
(even if Linux chooses to be device-tree-based for some arbitrary subset
of that information) is incompatible with a flexible virtual platform.
All this compatible is saying is "see the rest of the device tree".
How well Linux does so is a quality of implementation issue that can be
addressed as needed. The information about what sort of interrupt
controller you have is already in the device tree. The device tree is
the machine spec.
Another assumption this patch makes is that it doesn't need SWIOTLB. Is
"has more than 4GiB RAM" a machine attribute that would warrant a
separate toplevel compatible? SWIOTLB for PCI is handled due to the
previous patch that provides common PCI code -- but in a previous
version of the patch it was not handled. Is it yet another incompatible
machine spec if RAM must be less than 4GiB minus PCICSRBAR (ignoring the
QEMU bug that PCICSRBAR is not implemented)?
quoted
Better to change the Linux implementation as needed than to change a spec.
Why not keep the 2 in sync in the same patch? Just throw a file with a rough outline of the machine in Documentation/.
Because that would give people the wrong impression about what this
machine is, and be unlikely to stay in sync or be a complete listing of
current assumptions. You're basically suggesting to use Documentation/
as a bug tracker.
-Scott
From: Alexander Graf <hidden> Date: 2012-07-06 16:59:32
On 06.07.2012, at 18:52, Scott Wood wrote:
On 07/06/2012 11:30 AM, Alexander Graf wrote:
quoted
=20
On 06.07.2012, at 18:25, Scott Wood wrote:
=20
quoted
On 07/06/2012 07:29 AM, Alexander Graf wrote:
quoted
I really think we should document what exactly this machine =
expects.
quoted
quoted
=20
Well, the point of this paravirt machine is to avoid such =
assumptions --
quoted
quoted
it's all device-tree driven, at least in theory. If a certain qemu
configuration ends up breaking the Linux platform (such as using a
different PIC), then that's a lack of flexibility on Linux's part =
that
quoted
quoted
should get fixed if someone finds it useful enough to justify the
effort. Same with real hardware -- if you care about it, you add
support -- we just don't have a unique name for every configuration.
The information is there in the device tree, though.
=20
Honestly, even having "qemu" in there is more specific than I'd =
prefer,
quoted
quoted
but I don't want to stir up the "generic platform" argument again
without at least limiting the scope.
=20
Well, can't we note down the assumptions we make to make sure that
whoever develops an implementation of it knows what to implement?
It's ppc specific for example. I also don't think that plugging a G3
in there works, would it?
=20
Well, it does have "e500" in the name. :-P
=20
=20
Does that mean we're configuring the MPIC regardless of what the
guest tells us? So the MPIC is a hard requirement. We can't use UIC
or XPIC with this machine, right? This needs to be documented.
=20
Then what would we do if we want to add an ePAPR virtual PIC =
instead?
quoted
quoted
Or if something replaces MPIC on future FSL chips?
=20
Then we need a different compatible anyways, because we wouldn't be =
backwards compatible, no?
=20
No, that's exactly what I'm trying to avoid. This notion of a =
toplevel
compatible that tells you everything you need to know about the =
machine
(even if Linux chooses to be device-tree-based for some arbitrary =
subset
of that information) is incompatible with a flexible virtual platform.
=20
All this compatible is saying is "see the rest of the device tree".
How well Linux does so is a quality of implementation issue that can =
be
addressed as needed. The information about what sort of interrupt
controller you have is already in the device tree. The device tree is
the machine spec.
=20
Another assumption this patch makes is that it doesn't need SWIOTLB. =
Is
"has more than 4GiB RAM" a machine attribute that would warrant a
separate toplevel compatible? SWIOTLB for PCI is handled due to the
previous patch that provides common PCI code -- but in a previous
version of the patch it was not handled. Is it yet another =
incompatible
machine spec if RAM must be less than 4GiB minus PCICSRBAR (ignoring =
the
QEMU bug that PCICSRBAR is not implemented)?
Well, the thing that I'm wary of is the following. Imagine we make this =
the default machine type for all e500 user cases. Which is reasonable. =
Now we release 3.6 which works awesome with QEMU 1.2. We change =
something in QEMU. QEMU 1.3 comes out. It can no longer boot your old =
kernel 3.6.
That's the type of situation I don't want to be in. We need to be =
backwards compatible with what we used to be able to run. We can get =
away with declaring things as experimental for now, until we settled on =
a reasonable compromise to achieve said compatibility. But it needs to =
be our goal somewhere.
One idea would be to version the machine type according to what Linux =
implements. If Linux finds a machine type that is newer than what it =
implements, it spawns a warning. If we want, we can implement backwards =
compatible machine types in QEMU, similar to how we implement -M pc-0.12 =
and friends today.
Again, no need to do so as long as we tell users to not use it. As soon =
as we want them to actually run the machine, we need to have independent =
upgrade paths in place. New QEMU needs to be able to run old kernels. =
New kernels need to be run on old QEMU.
=20
quoted
quoted
Better to change the Linux implementation as needed than to change a =
spec.
quoted
=20
Why not keep the 2 in sync in the same patch? Just throw a file with =
a rough outline of the machine in Documentation/.
=20
Because that would give people the wrong impression about what this
machine is, and be unlikely to stay in sync or be a complete listing =
of
current assumptions. You're basically suggesting to use =
Documentation/
as a bug tracker.
I'm just saying that every time we hardcode assumptions, we need to make =
sure we document it somewhere. And currently we do hardcode assumptions, =
even though only a few.
Alex
From: Scott Wood <hidden> Date: 2012-07-06 22:05:05
On 07/06/2012 11:59 AM, Alexander Graf wrote:
On 06.07.2012, at 18:52, Scott Wood wrote:
quoted
On 07/06/2012 11:30 AM, Alexander Graf wrote:
quoted
On 06.07.2012, at 18:25, Scott Wood wrote:
quoted
Then what would we do if we want to add an ePAPR virtual PIC
instead? Or if something replaces MPIC on future FSL chips?
Then we need a different compatible anyways, because we wouldn't
be backwards compatible, no?
No, that's exactly what I'm trying to avoid. This notion of a
toplevel compatible that tells you everything you need to know
about the machine (even if Linux chooses to be device-tree-based
for some arbitrary subset of that information) is incompatible with
a flexible virtual platform.
All this compatible is saying is "see the rest of the device
tree". How well Linux does so is a quality of implementation issue
that can be addressed as needed. The information about what sort
of interrupt controller you have is already in the device tree.
The device tree is the machine spec.
Another assumption this patch makes is that it doesn't need
SWIOTLB. Is "has more than 4GiB RAM" a machine attribute that
would warrant a separate toplevel compatible? SWIOTLB for PCI is
handled due to the previous patch that provides common PCI code --
but in a previous version of the patch it was not handled. Is it
yet another incompatible machine spec if RAM must be less than 4GiB
minus PCICSRBAR (ignoring the QEMU bug that PCICSRBAR is not
implemented)?
Well, the thing that I'm wary of is the following. Imagine we make
this the default machine type for all e500 user cases. Which is
reasonable. Now we release 3.6 which works awesome with QEMU 1.2. We
change something in QEMU. QEMU 1.3 comes out. It can no longer boot
your old kernel 3.6.
Do you expect your old kernel to boot when you get new hardware? QEMU
is basically hardware that is easy to change.
The only thing that using a more specific compatible would do is make
sure that the kernel wouldn't boot whenever it changes, rather than just
having a chance of certain combinations having problems.
Obviously we should make a reasonable effort to avoid gratuitous
breakage in the default config, but I just don't see how overspecifying
things is going to help.
That's the type of situation I don't want to be in. We need to be
backwards compatible with what we used to be able to run. We can get
away with declaring things as experimental for now, until we settled
on a reasonable compromise to achieve said compatibility. But it
needs to be our goal somewhere.
One idea would be to version the machine type according to what Linux
implements. If Linux finds a machine type that is newer than what it
implements, it spawns a warning.
What does it mean to have a version number for a platform which is
intended to eventually be arbitrarily configurable?
If we want, we can implement
backwards compatible machine types in QEMU, similar to how we
implement -M pc-0.12 and friends today.
Heh, I was just about to respond by saying "how would you version a PC"? :-)
If you want a stable versioned platform that happens to not pretend to
be a real board, go ahead and add one -- that's not what this is for.
Maybe instead of documenting things like "has an MPIC", there should be
some comment mentioning that this platform is intended to be flexible
and device tree driven, not static. The device tree is the machine
spec. I could see an argument for versioning individual devices, OTOH,
rather than e.g. pretending the PCI is really equivalent to an
mpc8540-pci despite significant missing functionality.
BTW, could you point me to the documentation that explains exactly what
a pc-0.12 is? And is there any place in Linux that actually sees this
version number and does anything with it? How would a user know what
version of a PC to request? What version do you get by default? Under
what conditions are the version number bumped?
Again, no need to do so as long as we tell users to not use it. As
soon as we want them to actually run the machine, we need to have
independent upgrade paths in place. New QEMU needs to be able to run
old kernels. New kernels need to be run on old QEMU.
They will, usually. We can't guarantee this will always be true
regardless of a versioning scheme, since bugs will happen.
quoted
quoted
quoted
Better to change the Linux implementation as needed than to
change a spec.
Why not keep the 2 in sync in the same patch? Just throw a file
with a rough outline of the machine in Documentation/.
Because that would give people the wrong impression about what
this machine is, and be unlikely to stay in sync or be a complete
listing of current assumptions. You're basically suggesting to use
Documentation/ as a bug tracker.
I'm just saying that every time we hardcode assumptions, we need to
make sure we document it somewhere. And currently we do hardcode
assumptions, even though only a few.
If you want a bug tracker, use a bug tracker. Linux already has plenty
of assumptions regarding the real hardware it runs on, how firmware
configures it, etc. Most of these assumptions are not documented, and
things get changed when new hardware comes along that breaks an
assumption. Most of the assumptions this platform would be making come
from outside the platform file itself. If I tried to document it, it
would be incomplete and quickly become out of date.
-Scott
From: Kumar Gala <hidden> Date: 2012-07-10 18:31:19
On Jun 27, 2012, at 6:50 PM, Scott Wood wrote:
Similar to how the primary PCI bridge is identified by looking
for an isa subnode, we determine whether to apply uli exclusions
by looking for a uli subnode.
=20
Signed-off-by: Scott Wood <redacted>
---
Besides being an example of a real-hardware board to use the new PCI =
init
(probably one of the more complicated examples due to the uli device
exclusion), this fixes PCI under QEMU's mpc8544ds machine. QEMU was
only creating one PCI bus, and it wasn't the one Linux had arbitrarily
deemed primary for mpc8544ds (AFAIK, there's no legacy ISA on this
board).
=20
Tested with QEMU mpc8544ds, and real-hardware mpc8572ds (with uli).
=20
arch/powerpc/platforms/85xx/mpc85xx_ds.c | 97 =