* Re: [PATCH 18/23] powerpc/eeh: PowerNV EEH backends
From: Gavin Shan @ 2013-06-03 1:10 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, Gavin Shan
In-Reply-To: <1370060971.3766.11.camel@pasglop>
On Sat, Jun 01, 2013 at 02:29:31PM +1000, Benjamin Herrenschmidt wrote:
>On Thu, 2013-05-30 at 16:24 +0800, Gavin Shan wrote:
>> The patch adds EEH backends for PowerNV platform. It's notable that
>> part of those EEH backends call to the I/O chip dependent backends.
>
>Add a check for my new OPALv3 flag before registering since you rely
>on a whole bunch of new APIs that the current versions of OPAL don't
>have.
>
Ok. I'll do it in next version :-)
Thanks,
Gavin
^ permalink raw reply
* Re: [PATCH 23/23] powerpc/eeh: Add debugfs entry to inject errors
From: Gavin Shan @ 2013-06-03 1:23 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, Gavin Shan
In-Reply-To: <1370061286.3766.17.camel@pasglop>
On Sat, Jun 01, 2013 at 02:34:46PM +1000, Benjamin Herrenschmidt wrote:
>On Thu, 2013-05-30 at 16:24 +0800, Gavin Shan wrote:
>> The patch intends to add debugfs entry powerpc/EEH/PHBx so that
>> the administrator can inject EEH errors to specified PCI host
>> bridge for testing purpose.
>
>Use a better naming for the debugfs files. Something like
>eeh_err_inject/pciNNNN, to be consistent with the general naming
>of PHBs in the system.
>
>However, maybe it would be better to instead having something along
>the lines of a directory per PHB with a file in it for error injection ?
>
>That way we can stick more things in there that can become handy for
>debugging / diagnostics, such as register dumps etc...
>
>
Yeah, I think it would be more reasonable to have one directory per PHB.
I'll make it in next version:
powerpc/pciNNNN/err_inject
Thanks,
Gavin
>> Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
>> ---
>> arch/powerpc/platforms/powernv/eeh-ioda.c | 36 ++++++++++++++++++++++++++++-
>> 1 files changed, 35 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/powerpc/platforms/powernv/eeh-ioda.c b/arch/powerpc/platforms/powernv/eeh-ioda.c
>> index ec5c524..4cc9db7 100644
>> --- a/arch/powerpc/platforms/powernv/eeh-ioda.c
>> +++ b/arch/powerpc/platforms/powernv/eeh-ioda.c
>> @@ -22,6 +22,7 @@
>>
>> #include <linux/bootmem.h>
>> #include <linux/delay.h>
>> +#include <linux/debugfs.h>
>> #include <linux/init.h>
>> #include <linux/io.h>
>> #include <linux/irq.h>
>> @@ -43,6 +44,29 @@
>> #include "powernv.h"
>> #include "pci.h"
>>
>> +static struct dentry *ioda_eeh_dbgfs = NULL;
>> +
>> +static int ioda_eeh_dbgfs_set(void *data, u64 val)
>> +{
>> + struct pci_controller *hose = data;
>> + struct pnv_phb *phb = hose->private_data;
>> +
>> + out_be64(phb->regs + 0xD10, val);
>> + return 0;
>> +}
>> +
>> +static int ioda_eeh_dbgfs_get(void *data, u64 *val)
>> +{
>> + struct pci_controller *hose = data;
>> + struct pnv_phb *phb = hose->private_data;
>> +
>> + *val = in_be64(phb->regs + 0xD10);
>> + return 0;
>> +}
>> +
>> +DEFINE_SIMPLE_ATTRIBUTE(ioda_eeh_dbgfs_ops, ioda_eeh_dbgfs_get,
>> + ioda_eeh_dbgfs_set, "0x%llx\n");
>> +
>> /**
>> * ioda_eeh_post_init - Chip dependent post initialization
>> * @hose: PCI controller
>> @@ -54,10 +78,20 @@
>> static int ioda_eeh_post_init(struct pci_controller *hose)
>> {
>> struct pnv_phb *phb = hose->private_data;
>> + char name[16];
>> +
>> + /* Create EEH debugfs root if possible */
>> + if (!ioda_eeh_dbgfs)
>> + ioda_eeh_dbgfs = debugfs_create_dir("EEH", powerpc_debugfs_root);
>>
>> /* FIXME: Enable it for PHB3 later */
>> - if (phb->type == PNV_PHB_IODA1)
>> + if (phb->type == PNV_PHB_IODA1) {
>> + sprintf(name, "PHB%d", hose->global_number);
>> + debugfs_create_file(name, 0600, ioda_eeh_dbgfs,
>> + hose, &ioda_eeh_dbgfs_ops);
>> +
>> phb->eeh_enabled = 1;
>> + }
>>
>> return 0;
>> }
>
>
^ permalink raw reply
* Re: [PATCH] powerpc/pci: Improve device hotplug initialization
From: Chen Yuanquan-B41889 @ 2013-06-03 2:28 UTC (permalink / raw)
To: Guenter Roeck
Cc: Yuanquan Chen, Hiroo Matsumoto, linux-kernel, Paul Mackerras,
linuxppc-dev
In-Reply-To: <20130601135809.GA6395@roeck-us.net>
On 06/01/2013 09:58 PM, Guenter Roeck wrote:
> On Fri, May 31, 2013 at 03:44:07PM +1000, Benjamin Herrenschmidt wrote:
>> On Thu, 2013-05-30 at 22:14 -0700, Guenter Roeck wrote:
>>> On Wed, May 29, 2013 at 05:30:41PM +0800, Chen Yuanquan-B41889 wrote:
>>>> On 05/29/2013 01:35 AM, Guenter Roeck wrote:
>>>>> bios_add_device(). Drop explicit calls to pcibios_setup_device();
>>>>> this makes pcibios_setup_bus_devices() a noop function which could
>>>>> eve
>>>> Yeah, it's more reasonable to do the irq and DMA related initialization
>>>> in one code path for all devices.
>>>>
>>> Any comments / feedback on the code itself ?
>> Sorry, I haven't had a chance to review it yet, I'm fairly bogged down
>> at the moment. I want to tread carefully because the previous iteration
>> of changing that stuff did break a few platforms in the end.
>>
> Hi Ben,
>
> the comment was actuially directed towards Yuanquan.
>
> No problem, take your time. I did my best to test it, but I agree that this is a
> critical area of the code, and it would be desirable to get additional scrutiny
> and test feedback.
>
> The code has been running in our system (P2020 and P5040) for several months.
> I was preparing a patch for upstream submission when I noticed commit 37f02195b.
> After testing ithis commit, I noticed the problems with it and wrote this patch,
> which aligns the code with our initial patch. I tested it as good as I could on
> our systems as well as with a P5040 evaluation board and an Intel GE PCIe
> card.
>
> Thanks,
> Guenter
>
Hi Guenter,
Your patch makes sure the initialization of DMA and irq in one code path
and also
avoids the initialization called two times(in pci bus scanning and
pci_enable_device()
in device driver) for no-hot-plugged pci device. It's much more reasonable!
I don't know why you also remove the function "set_dev_node()" ? As I
know, the
function just be called here. I think it should remain in your new function
pcibios_add_device().
Regards,
Yuanquan
>
^ permalink raw reply
* Re: [PATCH] powerpc/pci: Improve device hotplug initialization
From: Guenter Roeck @ 2013-06-03 4:11 UTC (permalink / raw)
To: Chen Yuanquan-B41889
Cc: Yuanquan Chen, Hiroo Matsumoto, linux-kernel, Paul Mackerras,
linuxppc-dev
In-Reply-To: <51ABFF5F.4020409@freescale.com>
On Mon, Jun 03, 2013 at 10:28:47AM +0800, Chen Yuanquan-B41889 wrote:
> On 06/01/2013 09:58 PM, Guenter Roeck wrote:
> >On Fri, May 31, 2013 at 03:44:07PM +1000, Benjamin Herrenschmidt wrote:
> >>On Thu, 2013-05-30 at 22:14 -0700, Guenter Roeck wrote:
> >>>On Wed, May 29, 2013 at 05:30:41PM +0800, Chen Yuanquan-B41889 wrote:
> >>>>On 05/29/2013 01:35 AM, Guenter Roeck wrote:
> >>>>>bios_add_device(). Drop explicit calls to pcibios_setup_device();
> >>>>>this makes pcibios_setup_bus_devices() a noop function which could
> >>>>>eve
> >>>>Yeah, it's more reasonable to do the irq and DMA related initialization
> >>>>in one code path for all devices.
> >>>>
> >>>Any comments / feedback on the code itself ?
> >>Sorry, I haven't had a chance to review it yet, I'm fairly bogged down
> >>at the moment. I want to tread carefully because the previous iteration
> >>of changing that stuff did break a few platforms in the end.
> >>
> >Hi Ben,
> >
> >the comment was actuially directed towards Yuanquan.
> >
> >No problem, take your time. I did my best to test it, but I agree that this is a
> >critical area of the code, and it would be desirable to get additional scrutiny
> >and test feedback.
> >
> >The code has been running in our system (P2020 and P5040) for several months.
> >I was preparing a patch for upstream submission when I noticed commit 37f02195b.
> >After testing ithis commit, I noticed the problems with it and wrote this patch,
> >which aligns the code with our initial patch. I tested it as good as I could on
> >our systems as well as with a P5040 evaluation board and an Intel GE PCIe
> >card.
> >
> >Thanks,
> >Guenter
> >
>
> Hi Guenter,
>
> Your patch makes sure the initialization of DMA and irq in one code
> path and also
> avoids the initialization called two times(in pci bus scanning and
> pci_enable_device()
> in device driver) for no-hot-plugged pci device. It's much more reasonable!
>
> I don't know why you also remove the function "set_dev_node()" ? As
> I know, the
> function just be called here. I think it should remain in your new function
> pcibios_add_device().
>
pcibios_add_device() is (only) called from pci_device_add(),
which already calls set_dev_node().
Guenter
^ permalink raw reply
* Re: FAILED: patch "[PATCH] powerpc/pseries: Always enable CONFIG_HOTPLUG_CPU on PSERIES" failed to apply to 3.9-stable tree
From: Srivatsa S. Bhat @ 2013-06-03 6:46 UTC (permalink / raw)
To: gregkh; +Cc: linuxppc-dev@lists.ozlabs.org list, adam, stable
In-Reply-To: <13701231324019@kroah.org>
On 06/02/2013 03:15 AM, gregkh@linuxfoundation.org wrote:
>
> The patch below does not apply to the 3.9-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.
>
Please find the 3.9 backport below. Thank you!
Regards,
Srivatsa S. Bhat
--------------------------------------------------------------------------
From: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Subject: [PATCH] powerpc/pseries: Always enable CONFIG_HOTPLUG_CPU on PSERIES SMP
commit f274ef8747d3be649bba8708696fb31cb00fa75a upstream.
Adam Lackorzynski reported the following build failure on
!CONFIG_HOTPLUG_CPU configuration:
CC arch/powerpc/kernel/rtas.o
arch/powerpc/kernel/rtas.c: In function ‘rtas_cpu_state_change_mask’:
arch/powerpc/kernel/rtas.c:843:4: error: implicit declaration of function ‘cpu_down’ [-Werror=implicit-function-declaration]
cc1: all warnings being treated as errors
make[1]: *** [arch/powerpc/kernel/rtas.o] Error 1
make: *** [arch/powerpc/kernel] Error 2
The build fails because cpu_down() is defined only under CONFIG_HOTPLUG_CPU.
Looking further, the mobility code in pseries is one of the call-sites which
uses rtas_ibm_suspend_me(), which in turn calls rtas_cpu_state_change_mask().
And the mobility code is unconditionally compiled-in (it does not fall under
any Kconfig option). And commit 120496ac (powerpc: Bring all threads online
prior to migration/hibernation) which introduced this build regression is
critical for the proper functioning of the migration code. So it appears
that the only solution to this problem is to enable CONFIG_HOTPLUG_CPU if
SMP is enabled on PPC_PSERIES platforms. So make that change in the Kconfig.
Reported-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
Cc: stable@vger.kernel.org
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
arch/powerpc/platforms/pseries/Kconfig | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
index 9a0941b..b9fd0d3 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -18,6 +18,8 @@ config PPC_PSERIES
select PPC_PCI_CHOICE if EXPERT
select ZLIB_DEFLATE
select PPC_DOORBELL
+ select HOTPLUG if SMP
+ select HOTPLUG_CPU if SMP
default y
config PPC_SPLPAR
^ permalink raw reply related
* Re: Build regressions/improvements in v3.10-rc4
From: Geert Uytterhoeven @ 2013-06-03 8:34 UTC (permalink / raw)
To: Linux Kernel Development; +Cc: x86, Linux/PPC Development, linux-sh
In-Reply-To: <alpine.DEB.2.00.1306031018320.18831@ayla.of.borg>
On Mon, 3 Jun 2013, Geert Uytterhoeven wrote:
> JFYI, when comparing v3.10-rc4 to v3.10-rc3[3], the summaries are:
> - build errors: +6/-2
> - build warnings: +66/-132
+ arch/powerpc/sysdev/mpic.c: error: case label does not reduce to an integer constant: => 890:9, 898:9, 886:9, 894:9
powerpc-randconfig
+ error: No rule to make target /etc/sound/msndinit.bin: => N/A
+ error: No rule to make target /etc/sound/msndperm.bin: => N/A
i386-randconfig
+ error: spi-rspi.c: undefined reference to `shdma_chan_filter': => .text+0x64f28), .text+0x65108)
sh-randconfig
There seems to be something wrong with the dependencies for SH_DMAE_BASE,
with more failures in linux-next for kota2_defconfig and marzen_defconfig
on ARM (http://kisskb.ellerman.id.au/kisskb/buildresult/8848370/ resp.
http://kisskb.ellerman.id.au/kisskb/buildresult/8848367/)
> [1] http://kisskb.ellerman.id.au/kisskb/head/6290/ (all 120 configs)
> [3] http://kisskb.ellerman.id.au/kisskb/head/6268/ (all 120 configs)
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply
* Re: DTB build failure due to preproccessing
From: Ian Campbell @ 2013-06-03 9:44 UTC (permalink / raw)
To: Grant Likely
Cc: Michal Marek, JonLoeliger, Stephen Warren, Stephen Warren,
linux-kbuild, linux-kernel, Rob Herring,
linuxppc-dev@lists.ozlabs.org
In-Reply-To: <CACxGe6vWtofRb3ysPueJ73e3O18vNegiLapcTg_JZ9eRmPL5BA@mail.gmail.com>
On Fri, 2013-05-31 at 17:31 +0100, Grant Likely wrote:
> On Fri, May 31, 2013 at 5:04 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> > On 05/31/2013 05:48 AM, Grant Likely wrote:
> >> ---
> >> commit d01dccdcb3ea8233b09efb9c24db9f057fbd3b37
> >> Author: Grant Likely <grant.likely@linaro.org>
> >> Date: Fri May 31 12:45:18 2013 +0100
> >>
> >> dtc: Suppress cpp linemarker annotations
> >>
> >> DTC isn't able to parse cpp linemarker annotations, so suppress them in
> >> the cpp output by adding the -P flag to the cpp options.
> >
> > That's not true; it explicitly does have code to parse the line markers.
> > I'll have to investigate why it isn't working in this case.
> >
> > If you apply this patch, then anyone who has switched to #include rther
> > than /include/ will get incorrect line numbers in dtc error messages.
> > Admittedly that's a smaller population right now though. Perhaps we
> > should just do a kernel-wide conversion though.
>
> My mistake. I tested the wrong thing. I've dropped the patch.
FWIW I've also dropped it from my device-tree.git tree.
Ian.
^ permalink raw reply
* Re: [PATCH] powerpc/sysfs: disable hotplug for the boot cpu
From: Zhao Chenhui @ 2013-06-03 10:43 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <1370036984.3928.144.camel@pasglop>
On Sat, Jun 01, 2013 at 07:49:44AM +1000, Benjamin Herrenschmidt wrote:
> On Tue, 2013-05-28 at 15:59 +0800, Zhao Chenhui wrote:
> > Some features depend on the boot cpu, for instance, hibernate/suspend.
> > So disable hotplug for the boot cpu.
>
> Don't we have code to "move" the boot CPU around when that happens ?
>
> Ben.
>
Currently, the code in generic_cpu_disable() likes this:
if (cpu == boot_cpuid)
return -EBUSY;
If the dying cpu is the boot cpu, it will return -EBUSY. In the subsequent error handling,
cpu_notify_nofail(CPU_DOWN_FAILED) in _cpu_down() will be called. Unfortunately, some
cpu notifier callbacks handled CPU_DOWN_PREPARE, but not CPU_DOWN_FAILED, such as sched_cpu_inactive().
So it will cause issues.
If we set the hotpluggable for the boot cpu, we can prevent user applications from disabling the boot cpu.
-Chenhui
> > Signed-off-by: Zhao Chenhui <chenhui.zhao@freescale.com>
> > ---
> > arch/powerpc/kernel/sysfs.c | 4 +++-
> > 1 files changed, 3 insertions(+), 1 deletions(-)
> >
> > diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
> > index e68a845..294b1c4e 100644
> > --- a/arch/powerpc/kernel/sysfs.c
> > +++ b/arch/powerpc/kernel/sysfs.c
> > @@ -655,8 +655,10 @@ static int __init topology_init(void)
> > * CPU. For instance, the boot cpu might never be valid
> > * for hotplugging.
> > */
> > - if (ppc_md.cpu_die)
> > + if (ppc_md.cpu_die && cpu != boot_cpuid)
> > c->hotpluggable = 1;
> > + else
> > + c->hotpluggable = 0;
> >
> > if (cpu_online(cpu) || c->hotpluggable) {
> > register_cpu(c, cpu);
>
>
>
^ permalink raw reply
* powerpc/tm: Fix 32bit non-rt signal return
From: Michael Neuling @ 2013-06-03 10:56 UTC (permalink / raw)
To: benh; +Cc: Linux PPC dev, matt
Currently sys_sigreturn() is transactional memory unaware, hence if we take a
32 bit signal without SIGINFO (non RT) inside a transaction, we don't restore
the signal frame correctly on return.
This checks if the signal frame being restoring is an active transaction, and
if so, it copies the additional state to the ptregs so it can be restored.
Signed-off-by: Michael Neuling <mikey@neuling.org>
cc: <stable@vger.kernel.org> # 3.9 only
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index 201385c..0bc961b 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -1481,16 +1481,22 @@ badframe:
long sys_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
struct pt_regs *regs)
{
+ struct sigframe __user *sf;
struct sigcontext __user *sc;
struct sigcontext sigctx;
struct mcontext __user *sr;
void __user *addr;
sigset_t set;
+#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
+ struct mcontext __user *mcp, *tm_mcp;
+ unsigned long msr_hi;
+#endif
/* Always make any pending restarted system calls return -EINTR */
current_thread_info()->restart_block.fn = do_no_restart_syscall;
- sc = (struct sigcontext __user *)(regs->gpr[1] + __SIGNAL_FRAMESIZE);
+ sf = (struct sigframe __user *)(regs->gpr[1] + __SIGNAL_FRAMESIZE);
+ sc = &sf->sctx;
addr = sc;
if (copy_from_user(&sigctx, sc, sizeof(sigctx)))
goto badframe;
@@ -1507,12 +1513,23 @@ long sys_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
#endif
set_current_blocked(&set);
- sr = (struct mcontext __user *)from_user_ptr(sigctx.regs);
- addr = sr;
- if (!access_ok(VERIFY_READ, sr, sizeof(*sr))
- || restore_user_regs(regs, sr, 1))
+#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
+ mcp = (struct mcontext __user *)&sf->mctx;
+ tm_mcp = (struct mcontext __user *)&sf->mctx_transact;
+ if (__get_user(msr_hi, &mcp->mc_gregs[PT_MSR]))
goto badframe;
-
+ if MSR_TM_ACTIVE(msr_hi<<32) {
+ if (restore_tm_user_regs(regs, mcp, tm_mcp))
+ goto badframe;
+ } else
+#endif
+ {
+ sr = (struct mcontext __user *)from_user_ptr(sigctx.regs);
+ addr = sr;
+ if (!access_ok(VERIFY_READ, sr, sizeof(*sr))
+ || restore_user_regs(regs, sr, 1))
+ goto badframe;
+ }
set_thread_flag(TIF_RESTOREALL);
return 0;
^ permalink raw reply related
* [PATCH] powerpc/4xx: Fix warning in kilauea.dtb
From: Ian Campbell @ 2013-06-03 11:00 UTC (permalink / raw)
To: linux-kernel
Cc: Ian Campbell, Tirumala R Marri, Rupjyoti Sarmah, Josh Boyer,
Paul Mackerras, linuxppc-dev
Currently I see:
DTC arch/powerpc/boot/kilauea.dtb
Warning (reg_format): "reg" property in /plb/ppc4xx-msi@C10000000 has invalid length (12 bytes) (#address-cells == 1, #size-cells == 1)
It appears that unlike the other plarforms handled by 3fb7933850fa
"powerpc/4xx: Adding PCIe MSI support" this platform does not use address-cells=2.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Rupjyoti Sarmah <rsarmah@apm.com>
Cc: Tirumala R Marri <tmarri@apm.com>
Cc: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org
---
arch/powerpc/boot/dts/kilauea.dts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/boot/dts/kilauea.dts b/arch/powerpc/boot/dts/kilauea.dts
index 1613d6e..5ba7f01 100644
--- a/arch/powerpc/boot/dts/kilauea.dts
+++ b/arch/powerpc/boot/dts/kilauea.dts
@@ -406,7 +406,7 @@
MSI: ppc4xx-msi@C10000000 {
compatible = "amcc,ppc4xx-msi", "ppc4xx-msi";
- reg = < 0x0 0xEF620000 0x100>;
+ reg = <0xEF620000 0x100>;
sdr-base = <0x4B0>;
msi-data = <0x00000000>;
msi-mask = <0x44440000>;
--
1.7.10.4
^ permalink raw reply related
* [PATCH] powerpc/dts/virtex440: declare address/size-cells for phy device
From: Ian Campbell @ 2013-06-03 11:00 UTC (permalink / raw)
To: linux-kernel; +Cc: linuxppc-dev, Paul Mackerras, Ian Campbell, Gernot Vormayr
This fixes a warning:
DTC arch/powerpc/boot/virtex440-ml507.dtb
Warning (reg_format): "reg" property in /plb@0/xps-ll-temac@81c00000/ethernet@81c00000/phy@7 has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1)
Warning (avoid_default_addr_size): Relying on default #address-cells value for /plb@0/xps-ll-temac@81c00000/ethernet@81c00000/phy@7
Warning (avoid_default_addr_size): Relying on default #size-cells value for /plb@0/xps-ll-temac@81c00000/ethernet@81c00000/phy@7
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Gernot Vormayr <gvormayr@gmail.com>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org
---
arch/powerpc/boot/dts/virtex440-ml507.dts | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/powerpc/boot/dts/virtex440-ml507.dts b/arch/powerpc/boot/dts/virtex440-ml507.dts
index fc7073b..391a4e2 100644
--- a/arch/powerpc/boot/dts/virtex440-ml507.dts
+++ b/arch/powerpc/boot/dts/virtex440-ml507.dts
@@ -257,6 +257,8 @@
#size-cells = <1>;
compatible = "xlnx,compound";
ethernet@81c00000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
compatible = "xlnx,xps-ll-temac-1.01.b";
device_type = "network";
interrupt-parent = <&xps_intc_0>;
--
1.7.10.4
^ permalink raw reply related
* [PATCH] powerpc/boot: Ignore .dtb files.
From: Ian Campbell @ 2013-06-03 11:00 UTC (permalink / raw)
To: linux-kernel; +Cc: linuxppc-dev, Paul Mackerras, Ian Campbell
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org
---
arch/powerpc/boot/.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/boot/.gitignore b/arch/powerpc/boot/.gitignore
index c32ae5c..8fa258e 100644
--- a/arch/powerpc/boot/.gitignore
+++ b/arch/powerpc/boot/.gitignore
@@ -16,6 +16,7 @@ mktree
uImage
cuImage.*
dtbImage.*
+*.dtb
treeImage.*
zImage
zImage.initrd
--
1.7.10.4
^ permalink raw reply related
* [PATCH v1 1/1] mpc512x: silence a USB Kconfig dependency warning
From: Gerhard Sittig @ 2013-06-03 11:18 UTC (permalink / raw)
To: linuxppc-dev, linux-usb; +Cc: Gerhard Sittig, Anatolij Gustschin, Alan Stern
the PPC_MPC512x config automatically selected USB_EHCI_BIG_ENDIAN_*
switches, which made Kconfig warn about "unmet direct dependencies":
scripts/kconfig/conf --silentoldconfig Kconfig
warning: (PPC_MPC512x && 440EPX) selects USB_EHCI_BIG_ENDIAN_DESC which has unmet direct dependencies (USB_SUPPORT && USB && USB_EHCI_HCD)
warning: (PPC_MPC512x && PPC_PS3 && PPC_CELLEB && 440EPX) selects USB_EHCI_BIG_ENDIAN_MMIO which has unmet direct dependencies (USB_SUPPORT && USB && USB_EHCI_HCD)
warning: (PPC_MPC512x && 440EPX) selects USB_EHCI_BIG_ENDIAN_DESC which has unmet direct dependencies (USB_SUPPORT && USB && USB_EHCI_HCD)
warning: (PPC_MPC512x && PPC_PS3 && PPC_CELLEB && 440EPX) selects USB_EHCI_BIG_ENDIAN_MMIO which has unmet direct dependencies (USB_SUPPORT && USB && USB_EHCI_HCD)
make the selected entries additionally depend on USB_EHCI_HCD which
silences the warning
Signed-off-by: Gerhard Sittig <gsi@denx.de>
---
arch/powerpc/platforms/512x/Kconfig | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/512x/Kconfig b/arch/powerpc/platforms/512x/Kconfig
index aaf1edb..049fb7b 100644
--- a/arch/powerpc/platforms/512x/Kconfig
+++ b/arch/powerpc/platforms/512x/Kconfig
@@ -17,8 +17,8 @@ config PPC_MPC512x
select PPC_PCI_CHOICE
select FSL_PCI if PCI
select ARCH_WANT_OPTIONAL_GPIOLIB
- select USB_EHCI_BIG_ENDIAN_MMIO
- select USB_EHCI_BIG_ENDIAN_DESC
+ select USB_EHCI_BIG_ENDIAN_MMIO if USB_EHCI_HCD
+ select USB_EHCI_BIG_ENDIAN_DESC if USB_EHCI_HCD
config MPC5121_ADS
bool "Freescale MPC5121E ADS"
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH V2] dtc: ensure #line directives don't consume data from the next line
From: Jon Loeliger @ 2013-06-03 13:32 UTC (permalink / raw)
To: Stephen Warren
Cc: mmarek, Stephen Warren, linux-kbuild, devicetree-discuss,
linux-kernel, rob.herring, linuxppc-dev, David Gibson
In-Reply-To: <1370025184-23808-1-git-send-email-swarren@wwwdotorg.org>
> From: Stephen Warren <swarren@nvidia.com>
>
> Previously, the #line parsing regex ended with ({WS}+[0-9]+)?. The {WS}
> could match line-break characters. If the #line directive did not contain
> the optional flags field at the end, this could cause any integer data on
> the next line to be consumed as part of the #line directive parsing. This
> could cause syntax errors (i.e. #line parsing consuming the leading 0
> from a hex literal 0x1234, leaving x1234 to be parsed as cell data,
> which is a syntax error), or invalid compilation results (i.e. simply
> consuming literal 1234 as part of the #line processing, thus removing it
> from the cell data).
>
> Fix this by replacing {WS} with [ \t] so that it can't match line-breaks.
>
> Convert all instances of {WS}, even though the other instances should be
> irrelevant for any well-formed #line directive. This is done for
> consistency and ultimate safety.
>
> Reported-by: Ian Campbell <Ian.Campbell@citrix.com>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
> v2: Convert all instances of {WS} in the regex.
Applied.
Thanks!
jdl
^ permalink raw reply
* Re: [PATCH] powerpc/4xx: Fix warning in kilauea.dtb
From: Josh Boyer @ 2013-06-03 13:36 UTC (permalink / raw)
To: Ian Campbell
Cc: Tirumala R Marri, Rupjyoti Sarmah, linux-kernel, Josh Boyer,
Paul Mackerras, linuxppc-dev
In-Reply-To: <1370257224-23805-1-git-send-email-ian.campbell@citrix.com>
On Mon, Jun 03, 2013 at 12:00:24PM +0100, Ian Campbell wrote:
>Currently I see:
> DTC arch/powerpc/boot/kilauea.dtb
>Warning (reg_format): "reg" property in /plb/ppc4xx-msi@C10000000 has invalid length (12 bytes) (#address-cells == 1, #size-cells == 1)
>
>It appears that unlike the other plarforms handled by 3fb7933850fa
>"powerpc/4xx: Adding PCIe MSI support" this platform does not use address-cells=2.
Right, it's a 405, not a 440. I should have caught that in the initial
review.
>Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
>Cc: Rupjyoti Sarmah <rsarmah@apm.com>
>Cc: Tirumala R Marri <tmarri@apm.com>
>Cc: Josh Boyer <jwboyer@linux.vnet.ibm.com>
That address should bounce. It hasn't been active in almost 2 years.
>Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>Cc: Paul Mackerras <paulus@samba.org>
>Cc: linuxppc-dev@lists.ozlabs.org
>Cc: linux-kernel@vger.kernel.org
Acked-by: Josh Boyer <jwboyer@gmail.com>
>---
> arch/powerpc/boot/dts/kilauea.dts | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/arch/powerpc/boot/dts/kilauea.dts b/arch/powerpc/boot/dts/kilauea.dts
>index 1613d6e..5ba7f01 100644
>--- a/arch/powerpc/boot/dts/kilauea.dts
>+++ b/arch/powerpc/boot/dts/kilauea.dts
>@@ -406,7 +406,7 @@
>
> MSI: ppc4xx-msi@C10000000 {
> compatible = "amcc,ppc4xx-msi", "ppc4xx-msi";
>- reg = < 0x0 0xEF620000 0x100>;
>+ reg = <0xEF620000 0x100>;
> sdr-base = <0x4B0>;
> msi-data = <0x00000000>;
> msi-mask = <0x44440000>;
>--
>1.7.10.4
>
>_______________________________________________
>Linuxppc-dev mailing list
>Linuxppc-dev@lists.ozlabs.org
>https://lists.ozlabs.org/listinfo/linuxppc-dev
^ permalink raw reply
* Re: [PATCH] powerpc/4xx: Fix warning in kilauea.dtb
From: Ian Campbell @ 2013-06-03 13:49 UTC (permalink / raw)
To: Josh Boyer
Cc: Tirumala R Marri, Paul Mackerras, linuxppc-dev, Rupjyoti Sarmah,
linux-kernel
In-Reply-To: <20130603133633.GA18391@zod>
On Mon, 2013-06-03 at 09:36 -0400, Josh Boyer wrote:
> On Mon, Jun 03, 2013 at 12:00:24PM +0100, Ian Campbell wrote:
> >Currently I see:
> > DTC arch/powerpc/boot/kilauea.dtb
> >Warning (reg_format): "reg" property in /plb/ppc4xx-msi@C10000000 has invalid length (12 bytes) (#address-cells == 1, #size-cells == 1)
> >
> >It appears that unlike the other plarforms handled by 3fb7933850fa
> >"powerpc/4xx: Adding PCIe MSI support" this platform does not use address-cells=2.
>
> Right, it's a 405, not a 440. I should have caught that in the initial
> review.
>
> >Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> >Cc: Rupjyoti Sarmah <rsarmah@apm.com>
> >Cc: Tirumala R Marri <tmarri@apm.com>
> >Cc: Josh Boyer <jwboyer@linux.vnet.ibm.com>
>
> That address should bounce. It hasn't been active in almost 2 years.
Funnily enough the previous patch to this file (where I nabbed the
address from) was approximately that long ago ;-)
I've updated my local copy with your Ack with the correct address,
thanks.
I also corrected the "plarforms" typo which I just spotted...
Ian.
> >Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> >Cc: Paul Mackerras <paulus@samba.org>
> >Cc: linuxppc-dev@lists.ozlabs.org
> >Cc: linux-kernel@vger.kernel.org
>
> Acked-by: Josh Boyer <jwboyer@gmail.com>
>
> >---
> > arch/powerpc/boot/dts/kilauea.dts | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> >diff --git a/arch/powerpc/boot/dts/kilauea.dts b/arch/powerpc/boot/dts/kilauea.dts
> >index 1613d6e..5ba7f01 100644
> >--- a/arch/powerpc/boot/dts/kilauea.dts
> >+++ b/arch/powerpc/boot/dts/kilauea.dts
> >@@ -406,7 +406,7 @@
> >
> > MSI: ppc4xx-msi@C10000000 {
> > compatible = "amcc,ppc4xx-msi", "ppc4xx-msi";
> >- reg = < 0x0 0xEF620000 0x100>;
> >+ reg = <0xEF620000 0x100>;
> > sdr-base = <0x4B0>;
> > msi-data = <0x00000000>;
> > msi-mask = <0x44440000>;
> >--
> >1.7.10.4
> >
> >_______________________________________________
> >Linuxppc-dev mailing list
> >Linuxppc-dev@lists.ozlabs.org
> >https://lists.ozlabs.org/listinfo/linuxppc-dev
^ permalink raw reply
* [PATCH] dtc: ensure #line directives don't consume data from the next line
From: Stephen Warren @ 2013-06-03 15:36 UTC (permalink / raw)
To: Grant Likely, Rob Herring
Cc: Michal Marek, jdl, Stephen Warren, Ian Campbell, linux-kbuild,
devicetree-discuss, linux-kernel, linuxppc-dev
From: Stephen Warren <swarren@nvidia.com>
Previously, the #line parsing regex ended with ({WS}+[0-9]+)?. The {WS}
could match line-break characters. If the #line directive did not contain
the optional flags field at the end, this could cause any integer data on
the next line to be consumed as part of the #line directive parsing. This
could cause syntax errors (i.e. #line parsing consuming the leading 0
from a hex literal 0x1234, leaving x1234 to be parsed as cell data,
which is a syntax error), or invalid compilation results (i.e. simply
consuming literal 1234 as part of the #line processing, thus removing it
from the cell data).
Fix this by replacing {WS} with [ \t] so that it can't match line-breaks.
Convert all instances of {WS}, even though the other instances should be
irrelevant for any well-formed #line directive. This is done for
consistency and ultimate safety.
This is a port of upstream dtc commit a1ee6f0 (with same subject) to the
kernel's copy of dtc.
Reported-by: Ian Campbell <Ian.Campbell@citrix.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
This is a fix for 3.10.
scripts/dtc/dtc-lexer.l | 2 +-
scripts/dtc/dtc-lexer.lex.c_shipped | 232 +++++++++++++++++------------------
2 files changed, 117 insertions(+), 117 deletions(-)
diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l
index 254d5af..3b41bfc 100644
--- a/scripts/dtc/dtc-lexer.l
+++ b/scripts/dtc/dtc-lexer.l
@@ -71,7 +71,7 @@ static int pop_input_file(void);
push_input_file(name);
}
-<*>^"#"(line)?{WS}+[0-9]+{WS}+{STRING}({WS}+[0-9]+)? {
+<*>^"#"(line)?[ \t]+[0-9]+[ \t]+{STRING}([ \t]+[0-9]+)? {
char *line, *tmp, *fn;
/* skip text before line # */
line = yytext;
diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped
index a6c5fcd..2d30f41 100644
--- a/scripts/dtc/dtc-lexer.lex.c_shipped
+++ b/scripts/dtc/dtc-lexer.lex.c_shipped
@@ -405,19 +405,19 @@ static yyconst flex_int16_t yy_accept[161] =
static yyconst flex_int32_t yy_ec[256] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
- 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
+ 4, 4, 4, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 4, 5, 6, 1, 1, 7, 8, 1,
- 1, 9, 10, 10, 11, 10, 12, 13, 14, 15,
- 15, 15, 15, 15, 15, 15, 15, 16, 1, 17,
- 18, 19, 10, 10, 20, 20, 20, 20, 20, 20,
- 21, 21, 21, 21, 21, 22, 21, 21, 21, 21,
- 21, 21, 21, 21, 23, 21, 21, 24, 21, 21,
- 1, 25, 26, 1, 21, 1, 20, 27, 28, 29,
-
- 30, 20, 21, 21, 31, 21, 21, 32, 33, 34,
- 35, 36, 21, 37, 38, 39, 40, 41, 21, 24,
- 42, 21, 43, 44, 45, 1, 1, 1, 1, 1,
+ 1, 2, 5, 6, 7, 1, 1, 8, 9, 1,
+ 1, 10, 11, 11, 12, 11, 13, 14, 15, 16,
+ 16, 16, 16, 16, 16, 16, 16, 17, 1, 18,
+ 19, 20, 11, 11, 21, 21, 21, 21, 21, 21,
+ 22, 22, 22, 22, 22, 23, 22, 22, 22, 22,
+ 22, 22, 22, 22, 24, 22, 22, 25, 22, 22,
+ 1, 26, 27, 1, 22, 1, 21, 28, 29, 30,
+
+ 31, 21, 22, 22, 32, 22, 22, 33, 34, 35,
+ 36, 37, 22, 38, 39, 40, 41, 42, 22, 25,
+ 43, 22, 44, 45, 46, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -434,36 +434,36 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst flex_int32_t yy_meta[46] =
+static yyconst flex_int32_t yy_meta[47] =
{ 0,
- 1, 1, 1, 1, 1, 2, 3, 1, 2, 2,
- 2, 4, 5, 5, 5, 6, 1, 1, 1, 7,
- 8, 8, 8, 8, 1, 1, 7, 7, 7, 7,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 3, 1, 1
+ 1, 1, 1, 1, 1, 1, 2, 3, 1, 2,
+ 2, 2, 4, 5, 5, 5, 6, 1, 1, 1,
+ 7, 8, 8, 8, 8, 1, 1, 7, 7, 7,
+ 7, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 3, 1, 1
} ;
static yyconst flex_int16_t yy_base[175] =
{ 0,
- 0, 388, 381, 40, 41, 386, 71, 385, 34, 44,
- 390, 395, 60, 62, 371, 112, 111, 111, 111, 104,
- 370, 106, 371, 342, 124, 119, 0, 144, 395, 0,
- 123, 0, 159, 153, 165, 167, 395, 130, 395, 382,
- 395, 0, 372, 122, 395, 157, 374, 379, 350, 21,
- 346, 349, 395, 395, 395, 395, 395, 362, 395, 395,
- 181, 346, 342, 395, 359, 0, 191, 343, 190, 351,
- 350, 0, 0, 0, 173, 362, 177, 367, 357, 329,
- 335, 328, 337, 331, 206, 329, 334, 327, 395, 338,
- 170, 314, 346, 345, 318, 325, 343, 158, 316, 212,
-
- 322, 319, 320, 395, 340, 336, 308, 305, 314, 304,
- 295, 138, 208, 220, 395, 292, 305, 265, 264, 254,
- 201, 222, 285, 275, 273, 270, 236, 235, 225, 115,
- 395, 395, 252, 216, 216, 217, 214, 230, 209, 220,
- 213, 239, 211, 217, 216, 209, 229, 395, 240, 225,
- 206, 169, 395, 395, 116, 106, 99, 54, 395, 395,
- 254, 260, 268, 272, 276, 282, 289, 293, 301, 309,
- 313, 319, 327, 335
+ 0, 385, 378, 40, 41, 383, 72, 382, 34, 44,
+ 388, 393, 61, 117, 368, 116, 115, 115, 115, 48,
+ 367, 107, 368, 339, 127, 120, 0, 147, 393, 0,
+ 127, 0, 133, 156, 168, 153, 393, 125, 393, 380,
+ 393, 0, 369, 127, 393, 160, 371, 377, 347, 21,
+ 343, 346, 393, 393, 393, 393, 393, 359, 393, 393,
+ 183, 343, 339, 393, 356, 0, 183, 340, 187, 348,
+ 347, 0, 0, 0, 178, 359, 195, 365, 354, 326,
+ 332, 325, 334, 328, 204, 326, 331, 324, 393, 335,
+ 150, 311, 343, 342, 315, 322, 340, 179, 313, 207,
+
+ 319, 316, 317, 393, 337, 333, 305, 302, 311, 301,
+ 310, 190, 338, 337, 393, 307, 322, 301, 305, 277,
+ 208, 311, 307, 278, 271, 270, 248, 246, 213, 130,
+ 393, 393, 263, 235, 207, 221, 218, 229, 213, 213,
+ 206, 234, 218, 210, 208, 193, 219, 393, 223, 204,
+ 176, 157, 393, 393, 120, 106, 97, 119, 393, 393,
+ 245, 251, 259, 263, 267, 273, 280, 284, 292, 300,
+ 304, 310, 318, 326
} ;
static yyconst flex_int16_t yy_def[175] =
@@ -489,108 +489,108 @@ static yyconst flex_int16_t yy_def[175] =
160, 160, 160, 160
} ;
-static yyconst flex_int16_t yy_nxt[441] =
+static yyconst flex_int16_t yy_nxt[440] =
{ 0,
- 12, 13, 14, 15, 16, 12, 17, 18, 12, 12,
- 12, 19, 12, 12, 12, 12, 20, 21, 22, 23,
- 23, 23, 23, 23, 12, 12, 23, 23, 23, 23,
+ 12, 13, 14, 13, 15, 16, 12, 17, 18, 12,
+ 12, 12, 19, 12, 12, 12, 12, 20, 21, 22,
+ 23, 23, 23, 23, 23, 12, 12, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
- 23, 23, 12, 24, 12, 25, 34, 35, 35, 25,
- 81, 26, 26, 27, 27, 27, 34, 35, 35, 82,
- 28, 36, 36, 36, 36, 159, 29, 28, 28, 28,
- 28, 12, 13, 14, 15, 16, 30, 17, 18, 30,
- 30, 30, 26, 30, 30, 30, 12, 20, 21, 22,
- 31, 31, 31, 31, 31, 32, 12, 31, 31, 31,
+ 23, 23, 23, 12, 24, 12, 25, 34, 35, 35,
+ 25, 81, 26, 26, 27, 27, 27, 34, 35, 35,
+ 82, 28, 36, 36, 36, 53, 54, 29, 28, 28,
+ 28, 28, 12, 13, 14, 13, 15, 16, 30, 17,
+ 18, 30, 30, 30, 26, 30, 30, 30, 12, 20,
+ 21, 22, 31, 31, 31, 31, 31, 32, 12, 31,
31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
- 31, 31, 31, 12, 24, 12, 39, 41, 45, 47,
- 53, 54, 48, 56, 57, 61, 61, 47, 66, 45,
- 48, 66, 66, 66, 39, 46, 40, 49, 59, 50,
- 158, 51, 122, 52, 157, 49, 46, 50, 136, 63,
- 137, 52, 156, 43, 40, 62, 65, 65, 65, 59,
- 61, 61, 123, 65, 75, 69, 69, 69, 36, 36,
- 65, 65, 65, 65, 70, 71, 72, 69, 69, 69,
- 45, 46, 61, 61, 109, 77, 70, 71, 93, 110,
- 68, 70, 71, 85, 85, 85, 66, 46, 155, 66,
-
- 66, 66, 69, 69, 69, 122, 59, 100, 100, 61,
- 61, 70, 71, 100, 100, 148, 112, 154, 85, 85,
- 85, 61, 61, 129, 129, 123, 129, 129, 135, 135,
- 135, 142, 142, 148, 143, 149, 153, 135, 135, 135,
- 142, 142, 160, 143, 152, 151, 150, 146, 145, 144,
- 141, 140, 139, 149, 38, 38, 38, 38, 38, 38,
- 38, 38, 42, 138, 134, 133, 42, 42, 44, 44,
- 44, 44, 44, 44, 44, 44, 58, 58, 58, 58,
- 64, 132, 64, 66, 131, 130, 66, 160, 66, 66,
- 67, 128, 127, 67, 67, 67, 67, 73, 126, 73,
-
- 73, 76, 76, 76, 76, 76, 76, 76, 76, 78,
- 78, 78, 78, 78, 78, 78, 78, 91, 125, 91,
- 92, 124, 92, 92, 120, 92, 92, 121, 121, 121,
- 121, 121, 121, 121, 121, 147, 147, 147, 147, 147,
- 147, 147, 147, 119, 118, 117, 116, 115, 47, 114,
- 110, 113, 111, 108, 107, 106, 48, 105, 104, 89,
- 103, 102, 101, 99, 98, 97, 96, 95, 94, 79,
- 77, 90, 89, 88, 59, 87, 86, 59, 84, 83,
- 80, 79, 77, 74, 160, 60, 59, 55, 37, 160,
- 33, 25, 26, 25, 11, 160, 160, 160, 160, 160,
+ 31, 31, 31, 31, 31, 12, 24, 12, 36, 36,
+ 36, 39, 41, 45, 47, 56, 57, 48, 61, 47,
+ 39, 159, 48, 66, 61, 45, 66, 66, 66, 158,
+ 46, 40, 49, 59, 50, 157, 51, 49, 52, 50,
+ 40, 63, 46, 52, 36, 36, 36, 156, 43, 62,
+ 65, 65, 65, 59, 136, 68, 137, 65, 75, 69,
+ 69, 69, 70, 71, 65, 65, 65, 65, 70, 71,
+ 72, 69, 69, 69, 61, 46, 45, 155, 154, 66,
+ 70, 71, 66, 66, 66, 122, 85, 85, 85, 59,
+
+ 69, 69, 69, 46, 77, 100, 109, 93, 100, 70,
+ 71, 110, 112, 122, 129, 123, 153, 85, 85, 85,
+ 135, 135, 135, 148, 148, 160, 135, 135, 135, 152,
+ 142, 142, 142, 123, 143, 142, 142, 142, 151, 143,
+ 150, 146, 145, 149, 149, 38, 38, 38, 38, 38,
+ 38, 38, 38, 42, 144, 141, 140, 42, 42, 44,
+ 44, 44, 44, 44, 44, 44, 44, 58, 58, 58,
+ 58, 64, 139, 64, 66, 138, 134, 66, 133, 66,
+ 66, 67, 132, 131, 67, 67, 67, 67, 73, 130,
+ 73, 73, 76, 76, 76, 76, 76, 76, 76, 76,
+
+ 78, 78, 78, 78, 78, 78, 78, 78, 91, 160,
+ 91, 92, 129, 92, 92, 128, 92, 92, 121, 121,
+ 121, 121, 121, 121, 121, 121, 147, 147, 147, 147,
+ 147, 147, 147, 147, 127, 126, 125, 124, 61, 61,
+ 120, 119, 118, 117, 116, 115, 47, 114, 110, 113,
+ 111, 108, 107, 106, 48, 105, 104, 89, 103, 102,
+ 101, 99, 98, 97, 96, 95, 94, 79, 77, 90,
+ 89, 88, 59, 87, 86, 59, 84, 83, 80, 79,
+ 77, 74, 160, 60, 59, 55, 37, 160, 33, 25,
+ 26, 25, 11, 160, 160, 160, 160, 160, 160, 160,
160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160
+ 160, 160, 160, 160, 160, 160, 160, 160, 160
} ;
-static yyconst flex_int16_t yy_chk[441] =
+static yyconst flex_int16_t yy_chk[440] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 4, 9, 9, 9, 10,
- 50, 4, 5, 5, 5, 5, 10, 10, 10, 50,
- 5, 13, 13, 14, 14, 158, 5, 5, 5, 5,
- 5, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 1, 1, 1, 1, 1, 1, 4, 9, 9, 9,
+ 10, 50, 4, 5, 5, 5, 5, 10, 10, 10,
+ 50, 5, 13, 13, 13, 20, 20, 5, 5, 5,
+ 5, 5, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 16, 17, 18, 19,
- 20, 20, 19, 22, 22, 25, 25, 26, 31, 44,
- 26, 31, 31, 31, 38, 18, 16, 19, 31, 19,
- 157, 19, 112, 19, 156, 26, 44, 26, 130, 26,
- 130, 26, 155, 17, 38, 25, 28, 28, 28, 28,
- 33, 33, 112, 28, 46, 34, 34, 34, 36, 36,
- 28, 28, 28, 28, 34, 34, 34, 35, 35, 35,
- 75, 46, 61, 61, 98, 77, 35, 35, 77, 98,
- 33, 91, 91, 61, 61, 61, 67, 75, 152, 67,
-
- 67, 67, 69, 69, 69, 121, 67, 85, 85, 113,
- 113, 69, 69, 100, 100, 143, 100, 151, 85, 85,
- 85, 114, 114, 122, 122, 121, 129, 129, 135, 135,
- 135, 138, 138, 147, 138, 143, 150, 129, 129, 129,
- 142, 142, 149, 142, 146, 145, 144, 141, 140, 139,
- 137, 136, 134, 147, 161, 161, 161, 161, 161, 161,
- 161, 161, 162, 133, 128, 127, 162, 162, 163, 163,
- 163, 163, 163, 163, 163, 163, 164, 164, 164, 164,
- 165, 126, 165, 166, 125, 124, 166, 123, 166, 166,
- 167, 120, 119, 167, 167, 167, 167, 168, 118, 168,
-
- 168, 169, 169, 169, 169, 169, 169, 169, 169, 170,
- 170, 170, 170, 170, 170, 170, 170, 171, 117, 171,
- 172, 116, 172, 172, 111, 172, 172, 173, 173, 173,
- 173, 173, 173, 173, 173, 174, 174, 174, 174, 174,
- 174, 174, 174, 110, 109, 108, 107, 106, 105, 103,
- 102, 101, 99, 97, 96, 95, 94, 93, 92, 90,
- 88, 87, 86, 84, 83, 82, 81, 80, 79, 78,
- 76, 71, 70, 68, 65, 63, 62, 58, 52, 51,
- 49, 48, 47, 43, 40, 24, 23, 21, 15, 11,
- 8, 6, 3, 2, 160, 160, 160, 160, 160, 160,
+ 7, 7, 7, 7, 7, 7, 7, 7, 14, 14,
+ 14, 16, 17, 18, 19, 22, 22, 19, 25, 26,
+ 38, 158, 26, 31, 33, 44, 31, 31, 31, 157,
+ 18, 16, 19, 31, 19, 156, 19, 26, 19, 26,
+ 38, 26, 44, 26, 36, 36, 36, 155, 17, 25,
+ 28, 28, 28, 28, 130, 33, 130, 28, 46, 34,
+ 34, 34, 91, 91, 28, 28, 28, 28, 34, 34,
+ 34, 35, 35, 35, 61, 46, 75, 152, 151, 67,
+ 35, 35, 67, 67, 67, 112, 61, 61, 61, 67,
+
+ 69, 69, 69, 75, 77, 85, 98, 77, 100, 69,
+ 69, 98, 100, 121, 129, 112, 150, 85, 85, 85,
+ 135, 135, 135, 143, 147, 149, 129, 129, 129, 146,
+ 138, 138, 138, 121, 138, 142, 142, 142, 145, 142,
+ 144, 141, 140, 143, 147, 161, 161, 161, 161, 161,
+ 161, 161, 161, 162, 139, 137, 136, 162, 162, 163,
+ 163, 163, 163, 163, 163, 163, 163, 164, 164, 164,
+ 164, 165, 134, 165, 166, 133, 128, 166, 127, 166,
+ 166, 167, 126, 125, 167, 167, 167, 167, 168, 124,
+ 168, 168, 169, 169, 169, 169, 169, 169, 169, 169,
+
+ 170, 170, 170, 170, 170, 170, 170, 170, 171, 123,
+ 171, 172, 122, 172, 172, 120, 172, 172, 173, 173,
+ 173, 173, 173, 173, 173, 173, 174, 174, 174, 174,
+ 174, 174, 174, 174, 119, 118, 117, 116, 114, 113,
+ 111, 110, 109, 108, 107, 106, 105, 103, 102, 101,
+ 99, 97, 96, 95, 94, 93, 92, 90, 88, 87,
+ 86, 84, 83, 82, 81, 80, 79, 78, 76, 71,
+ 70, 68, 65, 63, 62, 58, 52, 51, 49, 48,
+ 47, 43, 40, 24, 23, 21, 15, 11, 8, 6,
+ 3, 2, 160, 160, 160, 160, 160, 160, 160, 160,
160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160
+ 160, 160, 160, 160, 160, 160, 160, 160, 160
} ;
static yy_state_type yy_last_accepting_state;
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH] dtc: ensure #line directives don't consume data from the next line
From: Ian Campbell @ 2013-06-03 16:02 UTC (permalink / raw)
To: Stephen Warren
Cc: Michal Marek, jdl, Stephen Warren, linux-kbuild,
devicetree-discuss, linux-kernel, Rob Herring, Grant Likely,
linuxppc-dev
In-Reply-To: <1370273816-19411-1-git-send-email-swarren@wwwdotorg.org>
On Mon, 2013-06-03 at 09:36 -0600, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> Previously, the #line parsing regex ended with ({WS}+[0-9]+)?. The {WS}
> could match line-break characters. If the #line directive did not contain
> the optional flags field at the end, this could cause any integer data on
> the next line to be consumed as part of the #line directive parsing. This
> could cause syntax errors (i.e. #line parsing consuming the leading 0
> from a hex literal 0x1234, leaving x1234 to be parsed as cell data,
> which is a syntax error), or invalid compilation results (i.e. simply
> consuming literal 1234 as part of the #line processing, thus removing it
> from the cell data).
>
> Fix this by replacing {WS} with [ \t] so that it can't match line-breaks.
>
> Convert all instances of {WS}, even though the other instances should be
> irrelevant for any well-formed #line directive. This is done for
> consistency and ultimate safety.
>
> This is a port of upstream dtc commit a1ee6f0 (with same subject) to the
> kernel's copy of dtc.
FWIW I have tested the upstream commit via my device-tree.git. If that
is considered sufficient then it is OK by me to apply
Tested-by: Ian Campbell <ian.campbell@citrix.com>
to this change too.
>
> Reported-by: Ian Campbell <Ian.Campbell@citrix.com>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
> This is a fix for 3.10.
>
> scripts/dtc/dtc-lexer.l | 2 +-
> scripts/dtc/dtc-lexer.lex.c_shipped | 232 +++++++++++++++++------------------
> 2 files changed, 117 insertions(+), 117 deletions(-)
>
> diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l
> index 254d5af..3b41bfc 100644
> --- a/scripts/dtc/dtc-lexer.l
> +++ b/scripts/dtc/dtc-lexer.l
> @@ -71,7 +71,7 @@ static int pop_input_file(void);
> push_input_file(name);
> }
>
> -<*>^"#"(line)?{WS}+[0-9]+{WS}+{STRING}({WS}+[0-9]+)? {
> +<*>^"#"(line)?[ \t]+[0-9]+[ \t]+{STRING}([ \t]+[0-9]+)? {
> char *line, *tmp, *fn;
> /* skip text before line # */
> line = yytext;
> diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped
> index a6c5fcd..2d30f41 100644
> --- a/scripts/dtc/dtc-lexer.lex.c_shipped
> +++ b/scripts/dtc/dtc-lexer.lex.c_shipped
> @@ -405,19 +405,19 @@ static yyconst flex_int16_t yy_accept[161] =
> static yyconst flex_int32_t yy_ec[256] =
> { 0,
> 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
> - 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
> + 4, 4, 4, 1, 1, 1, 1, 1, 1, 1,
> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> - 1, 2, 4, 5, 6, 1, 1, 7, 8, 1,
> - 1, 9, 10, 10, 11, 10, 12, 13, 14, 15,
> - 15, 15, 15, 15, 15, 15, 15, 16, 1, 17,
> - 18, 19, 10, 10, 20, 20, 20, 20, 20, 20,
> - 21, 21, 21, 21, 21, 22, 21, 21, 21, 21,
> - 21, 21, 21, 21, 23, 21, 21, 24, 21, 21,
> - 1, 25, 26, 1, 21, 1, 20, 27, 28, 29,
> -
> - 30, 20, 21, 21, 31, 21, 21, 32, 33, 34,
> - 35, 36, 21, 37, 38, 39, 40, 41, 21, 24,
> - 42, 21, 43, 44, 45, 1, 1, 1, 1, 1,
> + 1, 2, 5, 6, 7, 1, 1, 8, 9, 1,
> + 1, 10, 11, 11, 12, 11, 13, 14, 15, 16,
> + 16, 16, 16, 16, 16, 16, 16, 17, 1, 18,
> + 19, 20, 11, 11, 21, 21, 21, 21, 21, 21,
> + 22, 22, 22, 22, 22, 23, 22, 22, 22, 22,
> + 22, 22, 22, 22, 24, 22, 22, 25, 22, 22,
> + 1, 26, 27, 1, 22, 1, 21, 28, 29, 30,
> +
> + 31, 21, 22, 22, 32, 22, 22, 33, 34, 35,
> + 36, 37, 22, 38, 39, 40, 41, 42, 22, 25,
> + 43, 22, 44, 45, 46, 1, 1, 1, 1, 1,
> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> @@ -434,36 +434,36 @@ static yyconst flex_int32_t yy_ec[256] =
> 1, 1, 1, 1, 1
> } ;
>
> -static yyconst flex_int32_t yy_meta[46] =
> +static yyconst flex_int32_t yy_meta[47] =
> { 0,
> - 1, 1, 1, 1, 1, 2, 3, 1, 2, 2,
> - 2, 4, 5, 5, 5, 6, 1, 1, 1, 7,
> - 8, 8, 8, 8, 1, 1, 7, 7, 7, 7,
> - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
> - 8, 8, 3, 1, 1
> + 1, 1, 1, 1, 1, 1, 2, 3, 1, 2,
> + 2, 2, 4, 5, 5, 5, 6, 1, 1, 1,
> + 7, 8, 8, 8, 8, 1, 1, 7, 7, 7,
> + 7, 8, 8, 8, 8, 8, 8, 8, 8, 8,
> + 8, 8, 8, 3, 1, 1
> } ;
>
> static yyconst flex_int16_t yy_base[175] =
> { 0,
> - 0, 388, 381, 40, 41, 386, 71, 385, 34, 44,
> - 390, 395, 60, 62, 371, 112, 111, 111, 111, 104,
> - 370, 106, 371, 342, 124, 119, 0, 144, 395, 0,
> - 123, 0, 159, 153, 165, 167, 395, 130, 395, 382,
> - 395, 0, 372, 122, 395, 157, 374, 379, 350, 21,
> - 346, 349, 395, 395, 395, 395, 395, 362, 395, 395,
> - 181, 346, 342, 395, 359, 0, 191, 343, 190, 351,
> - 350, 0, 0, 0, 173, 362, 177, 367, 357, 329,
> - 335, 328, 337, 331, 206, 329, 334, 327, 395, 338,
> - 170, 314, 346, 345, 318, 325, 343, 158, 316, 212,
> -
> - 322, 319, 320, 395, 340, 336, 308, 305, 314, 304,
> - 295, 138, 208, 220, 395, 292, 305, 265, 264, 254,
> - 201, 222, 285, 275, 273, 270, 236, 235, 225, 115,
> - 395, 395, 252, 216, 216, 217, 214, 230, 209, 220,
> - 213, 239, 211, 217, 216, 209, 229, 395, 240, 225,
> - 206, 169, 395, 395, 116, 106, 99, 54, 395, 395,
> - 254, 260, 268, 272, 276, 282, 289, 293, 301, 309,
> - 313, 319, 327, 335
> + 0, 385, 378, 40, 41, 383, 72, 382, 34, 44,
> + 388, 393, 61, 117, 368, 116, 115, 115, 115, 48,
> + 367, 107, 368, 339, 127, 120, 0, 147, 393, 0,
> + 127, 0, 133, 156, 168, 153, 393, 125, 393, 380,
> + 393, 0, 369, 127, 393, 160, 371, 377, 347, 21,
> + 343, 346, 393, 393, 393, 393, 393, 359, 393, 393,
> + 183, 343, 339, 393, 356, 0, 183, 340, 187, 348,
> + 347, 0, 0, 0, 178, 359, 195, 365, 354, 326,
> + 332, 325, 334, 328, 204, 326, 331, 324, 393, 335,
> + 150, 311, 343, 342, 315, 322, 340, 179, 313, 207,
> +
> + 319, 316, 317, 393, 337, 333, 305, 302, 311, 301,
> + 310, 190, 338, 337, 393, 307, 322, 301, 305, 277,
> + 208, 311, 307, 278, 271, 270, 248, 246, 213, 130,
> + 393, 393, 263, 235, 207, 221, 218, 229, 213, 213,
> + 206, 234, 218, 210, 208, 193, 219, 393, 223, 204,
> + 176, 157, 393, 393, 120, 106, 97, 119, 393, 393,
> + 245, 251, 259, 263, 267, 273, 280, 284, 292, 300,
> + 304, 310, 318, 326
> } ;
>
> static yyconst flex_int16_t yy_def[175] =
> @@ -489,108 +489,108 @@ static yyconst flex_int16_t yy_def[175] =
> 160, 160, 160, 160
> } ;
>
> -static yyconst flex_int16_t yy_nxt[441] =
> +static yyconst flex_int16_t yy_nxt[440] =
> { 0,
> - 12, 13, 14, 15, 16, 12, 17, 18, 12, 12,
> - 12, 19, 12, 12, 12, 12, 20, 21, 22, 23,
> - 23, 23, 23, 23, 12, 12, 23, 23, 23, 23,
> + 12, 13, 14, 13, 15, 16, 12, 17, 18, 12,
> + 12, 12, 19, 12, 12, 12, 12, 20, 21, 22,
> + 23, 23, 23, 23, 23, 12, 12, 23, 23, 23,
> 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
> - 23, 23, 12, 24, 12, 25, 34, 35, 35, 25,
> - 81, 26, 26, 27, 27, 27, 34, 35, 35, 82,
> - 28, 36, 36, 36, 36, 159, 29, 28, 28, 28,
> - 28, 12, 13, 14, 15, 16, 30, 17, 18, 30,
> - 30, 30, 26, 30, 30, 30, 12, 20, 21, 22,
> - 31, 31, 31, 31, 31, 32, 12, 31, 31, 31,
> + 23, 23, 23, 12, 24, 12, 25, 34, 35, 35,
> + 25, 81, 26, 26, 27, 27, 27, 34, 35, 35,
> + 82, 28, 36, 36, 36, 53, 54, 29, 28, 28,
> + 28, 28, 12, 13, 14, 13, 15, 16, 30, 17,
> + 18, 30, 30, 30, 26, 30, 30, 30, 12, 20,
> + 21, 22, 31, 31, 31, 31, 31, 32, 12, 31,
>
> 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
> - 31, 31, 31, 12, 24, 12, 39, 41, 45, 47,
> - 53, 54, 48, 56, 57, 61, 61, 47, 66, 45,
> - 48, 66, 66, 66, 39, 46, 40, 49, 59, 50,
> - 158, 51, 122, 52, 157, 49, 46, 50, 136, 63,
> - 137, 52, 156, 43, 40, 62, 65, 65, 65, 59,
> - 61, 61, 123, 65, 75, 69, 69, 69, 36, 36,
> - 65, 65, 65, 65, 70, 71, 72, 69, 69, 69,
> - 45, 46, 61, 61, 109, 77, 70, 71, 93, 110,
> - 68, 70, 71, 85, 85, 85, 66, 46, 155, 66,
> -
> - 66, 66, 69, 69, 69, 122, 59, 100, 100, 61,
> - 61, 70, 71, 100, 100, 148, 112, 154, 85, 85,
> - 85, 61, 61, 129, 129, 123, 129, 129, 135, 135,
> - 135, 142, 142, 148, 143, 149, 153, 135, 135, 135,
> - 142, 142, 160, 143, 152, 151, 150, 146, 145, 144,
> - 141, 140, 139, 149, 38, 38, 38, 38, 38, 38,
> - 38, 38, 42, 138, 134, 133, 42, 42, 44, 44,
> - 44, 44, 44, 44, 44, 44, 58, 58, 58, 58,
> - 64, 132, 64, 66, 131, 130, 66, 160, 66, 66,
> - 67, 128, 127, 67, 67, 67, 67, 73, 126, 73,
> -
> - 73, 76, 76, 76, 76, 76, 76, 76, 76, 78,
> - 78, 78, 78, 78, 78, 78, 78, 91, 125, 91,
> - 92, 124, 92, 92, 120, 92, 92, 121, 121, 121,
> - 121, 121, 121, 121, 121, 147, 147, 147, 147, 147,
> - 147, 147, 147, 119, 118, 117, 116, 115, 47, 114,
> - 110, 113, 111, 108, 107, 106, 48, 105, 104, 89,
> - 103, 102, 101, 99, 98, 97, 96, 95, 94, 79,
> - 77, 90, 89, 88, 59, 87, 86, 59, 84, 83,
> - 80, 79, 77, 74, 160, 60, 59, 55, 37, 160,
> - 33, 25, 26, 25, 11, 160, 160, 160, 160, 160,
> + 31, 31, 31, 31, 31, 12, 24, 12, 36, 36,
> + 36, 39, 41, 45, 47, 56, 57, 48, 61, 47,
> + 39, 159, 48, 66, 61, 45, 66, 66, 66, 158,
> + 46, 40, 49, 59, 50, 157, 51, 49, 52, 50,
> + 40, 63, 46, 52, 36, 36, 36, 156, 43, 62,
> + 65, 65, 65, 59, 136, 68, 137, 65, 75, 69,
> + 69, 69, 70, 71, 65, 65, 65, 65, 70, 71,
> + 72, 69, 69, 69, 61, 46, 45, 155, 154, 66,
> + 70, 71, 66, 66, 66, 122, 85, 85, 85, 59,
> +
> + 69, 69, 69, 46, 77, 100, 109, 93, 100, 70,
> + 71, 110, 112, 122, 129, 123, 153, 85, 85, 85,
> + 135, 135, 135, 148, 148, 160, 135, 135, 135, 152,
> + 142, 142, 142, 123, 143, 142, 142, 142, 151, 143,
> + 150, 146, 145, 149, 149, 38, 38, 38, 38, 38,
> + 38, 38, 38, 42, 144, 141, 140, 42, 42, 44,
> + 44, 44, 44, 44, 44, 44, 44, 58, 58, 58,
> + 58, 64, 139, 64, 66, 138, 134, 66, 133, 66,
> + 66, 67, 132, 131, 67, 67, 67, 67, 73, 130,
> + 73, 73, 76, 76, 76, 76, 76, 76, 76, 76,
> +
> + 78, 78, 78, 78, 78, 78, 78, 78, 91, 160,
> + 91, 92, 129, 92, 92, 128, 92, 92, 121, 121,
> + 121, 121, 121, 121, 121, 121, 147, 147, 147, 147,
> + 147, 147, 147, 147, 127, 126, 125, 124, 61, 61,
> + 120, 119, 118, 117, 116, 115, 47, 114, 110, 113,
> + 111, 108, 107, 106, 48, 105, 104, 89, 103, 102,
> + 101, 99, 98, 97, 96, 95, 94, 79, 77, 90,
> + 89, 88, 59, 87, 86, 59, 84, 83, 80, 79,
> + 77, 74, 160, 60, 59, 55, 37, 160, 33, 25,
> + 26, 25, 11, 160, 160, 160, 160, 160, 160, 160,
>
> 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
> 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
> 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
> - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160
> + 160, 160, 160, 160, 160, 160, 160, 160, 160
> } ;
>
> -static yyconst flex_int16_t yy_chk[441] =
> +static yyconst flex_int16_t yy_chk[440] =
> { 0,
> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> - 1, 1, 1, 1, 1, 4, 9, 9, 9, 10,
> - 50, 4, 5, 5, 5, 5, 10, 10, 10, 50,
> - 5, 13, 13, 14, 14, 158, 5, 5, 5, 5,
> - 5, 7, 7, 7, 7, 7, 7, 7, 7, 7,
> + 1, 1, 1, 1, 1, 1, 4, 9, 9, 9,
> + 10, 50, 4, 5, 5, 5, 5, 10, 10, 10,
> + 50, 5, 13, 13, 13, 20, 20, 5, 5, 5,
> + 5, 5, 7, 7, 7, 7, 7, 7, 7, 7,
> 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
> 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
>
> 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
> - 7, 7, 7, 7, 7, 7, 16, 17, 18, 19,
> - 20, 20, 19, 22, 22, 25, 25, 26, 31, 44,
> - 26, 31, 31, 31, 38, 18, 16, 19, 31, 19,
> - 157, 19, 112, 19, 156, 26, 44, 26, 130, 26,
> - 130, 26, 155, 17, 38, 25, 28, 28, 28, 28,
> - 33, 33, 112, 28, 46, 34, 34, 34, 36, 36,
> - 28, 28, 28, 28, 34, 34, 34, 35, 35, 35,
> - 75, 46, 61, 61, 98, 77, 35, 35, 77, 98,
> - 33, 91, 91, 61, 61, 61, 67, 75, 152, 67,
> -
> - 67, 67, 69, 69, 69, 121, 67, 85, 85, 113,
> - 113, 69, 69, 100, 100, 143, 100, 151, 85, 85,
> - 85, 114, 114, 122, 122, 121, 129, 129, 135, 135,
> - 135, 138, 138, 147, 138, 143, 150, 129, 129, 129,
> - 142, 142, 149, 142, 146, 145, 144, 141, 140, 139,
> - 137, 136, 134, 147, 161, 161, 161, 161, 161, 161,
> - 161, 161, 162, 133, 128, 127, 162, 162, 163, 163,
> - 163, 163, 163, 163, 163, 163, 164, 164, 164, 164,
> - 165, 126, 165, 166, 125, 124, 166, 123, 166, 166,
> - 167, 120, 119, 167, 167, 167, 167, 168, 118, 168,
> -
> - 168, 169, 169, 169, 169, 169, 169, 169, 169, 170,
> - 170, 170, 170, 170, 170, 170, 170, 171, 117, 171,
> - 172, 116, 172, 172, 111, 172, 172, 173, 173, 173,
> - 173, 173, 173, 173, 173, 174, 174, 174, 174, 174,
> - 174, 174, 174, 110, 109, 108, 107, 106, 105, 103,
> - 102, 101, 99, 97, 96, 95, 94, 93, 92, 90,
> - 88, 87, 86, 84, 83, 82, 81, 80, 79, 78,
> - 76, 71, 70, 68, 65, 63, 62, 58, 52, 51,
> - 49, 48, 47, 43, 40, 24, 23, 21, 15, 11,
> - 8, 6, 3, 2, 160, 160, 160, 160, 160, 160,
> + 7, 7, 7, 7, 7, 7, 7, 7, 14, 14,
> + 14, 16, 17, 18, 19, 22, 22, 19, 25, 26,
> + 38, 158, 26, 31, 33, 44, 31, 31, 31, 157,
> + 18, 16, 19, 31, 19, 156, 19, 26, 19, 26,
> + 38, 26, 44, 26, 36, 36, 36, 155, 17, 25,
> + 28, 28, 28, 28, 130, 33, 130, 28, 46, 34,
> + 34, 34, 91, 91, 28, 28, 28, 28, 34, 34,
> + 34, 35, 35, 35, 61, 46, 75, 152, 151, 67,
> + 35, 35, 67, 67, 67, 112, 61, 61, 61, 67,
> +
> + 69, 69, 69, 75, 77, 85, 98, 77, 100, 69,
> + 69, 98, 100, 121, 129, 112, 150, 85, 85, 85,
> + 135, 135, 135, 143, 147, 149, 129, 129, 129, 146,
> + 138, 138, 138, 121, 138, 142, 142, 142, 145, 142,
> + 144, 141, 140, 143, 147, 161, 161, 161, 161, 161,
> + 161, 161, 161, 162, 139, 137, 136, 162, 162, 163,
> + 163, 163, 163, 163, 163, 163, 163, 164, 164, 164,
> + 164, 165, 134, 165, 166, 133, 128, 166, 127, 166,
> + 166, 167, 126, 125, 167, 167, 167, 167, 168, 124,
> + 168, 168, 169, 169, 169, 169, 169, 169, 169, 169,
> +
> + 170, 170, 170, 170, 170, 170, 170, 170, 171, 123,
> + 171, 172, 122, 172, 172, 120, 172, 172, 173, 173,
> + 173, 173, 173, 173, 173, 173, 174, 174, 174, 174,
> + 174, 174, 174, 174, 119, 118, 117, 116, 114, 113,
> + 111, 110, 109, 108, 107, 106, 105, 103, 102, 101,
> + 99, 97, 96, 95, 94, 93, 92, 90, 88, 87,
> + 86, 84, 83, 82, 81, 80, 79, 78, 76, 71,
> + 70, 68, 65, 63, 62, 58, 52, 51, 49, 48,
> + 47, 43, 40, 24, 23, 21, 15, 11, 8, 6,
> + 3, 2, 160, 160, 160, 160, 160, 160, 160, 160,
>
> 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
> 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
> 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
> - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160
> + 160, 160, 160, 160, 160, 160, 160, 160, 160
> } ;
>
> static yy_state_type yy_last_accepting_state;
^ permalink raw reply
* Re: [PATCH 1/3] powerpc/mpc85xx: remove the unneeded pci init functions for corenet ds board
From: Scott Wood @ 2013-06-03 16:42 UTC (permalink / raw)
To: Kevin Hao; +Cc: linuxppc
In-Reply-To: <20130602000720.GA22546@pek-khao-d1.corp.ad.wrs.com>
On 06/01/2013 07:07:20 PM, Kevin Hao wrote:
> On Sat, Jun 01, 2013 at 09:47:16PM +1000, Benjamin Herrenschmidt =20
> wrote:
> > On Sat, 2013-06-01 at 18:59 +0800, Kevin Hao wrote:
> >
> > > The effect of this change is that the isa_io_base will be 0 and =20
> the IO
> > > resource are equal to the virtual address of the IO space. But =20
> the IO
> > > functions such as outx/inx should work as well. This is why I ask =20
> the
> > > above question. What do you think about this? Are there any =20
> subtle bugs
> > > that will be triggered by this?
> >
> > I don't see any obvious reason why that wouldn't work but like =20
> anything
> > in that area, it needs a bit of testing & hammering to be sure ;-)
>=20
> Agreed.
Please include QEMU in your testing, as that was where breakage was =20
observed that caused us to add the default primary.
> > In fact it would work on pmac32 as well since those generally don't =20
> have
> > legacy crap either.
> >
> > So I have no fundamental objection, it just needs testing. My worry =20
> is
> > that we need to make sure we don't break old chrp and I don't have =20
> any
> > to test with.
>=20
> Don't worry, my patch just drop the picking of primary bus for several
> fsl boards. All these changes are in board specific file, so it should
> have no affect to other boards at all.
Is anything actually fixed by this?
-Scott=
^ permalink raw reply
* [RFC PATCH 1/6] KVM: PPC: Book3E: Fix AltiVec interrupt numbers and build breakage
From: Mihai Caraman @ 2013-06-03 20:54 UTC (permalink / raw)
To: kvm-ppc; +Cc: Mihai Caraman, linuxppc-dev, kvm
In-Reply-To: <1370292868-2697-1-git-send-email-mihai.caraman@freescale.com>
Interrupt numbers defined for Book3E follows IVORs definition. Align
BOOKE_INTERRUPT_ALTIVEC_UNAVAIL and BOOKE_INTERRUPT_ALTIVEC_ASSIST to this
rule which also fixes the build breakage.
IVORs 32 and 33 are shared so reflect this in the interrupts naming.
Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
---
arch/powerpc/include/asm/kvm_asm.h | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/include/asm/kvm_asm.h b/arch/powerpc/include/asm/kvm_asm.h
index b9dd382..851bac7 100644
--- a/arch/powerpc/include/asm/kvm_asm.h
+++ b/arch/powerpc/include/asm/kvm_asm.h
@@ -54,8 +54,16 @@
#define BOOKE_INTERRUPT_DEBUG 15
/* E500 */
-#define BOOKE_INTERRUPT_SPE_UNAVAIL 32
-#define BOOKE_INTERRUPT_SPE_FP_DATA 33
+#define BOOKE_INTERRUPT_SPE_ALTIVEC_UNAVAIL 32
+#define BOOKE_INTERRUPT_SPE_FP_DATA_ALTIVEC_ASSIST 33
+/*
+ * TODO: Unify 32-bit and 64-bit kernel exception handlers to use same defines
+ */
+#define BOOKE_INTERRUPT_SPE_UNAVAIL BOOKE_INTERRUPT_SPE_ALTIVEC_UNAVAIL
+#define BOOKE_INTERRUPT_SPE_FP_DATA BOOKE_INTERRUPT_SPE_FP_DATA_ALTIVEC_ASSIST
+#define BOOKE_INTERRUPT_ALTIVEC_UNAVAIL BOOKE_INTERRUPT_SPE_ALTIVEC_UNAVAIL
+#define BOOKE_INTERRUPT_ALTIVEC_ASSIST \
+ BOOKE_INTERRUPT_SPE_FP_DATA_ALTIVEC_ASSIST
#define BOOKE_INTERRUPT_SPE_FP_ROUND 34
#define BOOKE_INTERRUPT_PERFORMANCE_MONITOR 35
#define BOOKE_INTERRUPT_DOORBELL 36
@@ -67,10 +75,6 @@
#define BOOKE_INTERRUPT_HV_SYSCALL 40
#define BOOKE_INTERRUPT_HV_PRIV 41
-/* altivec */
-#define BOOKE_INTERRUPT_ALTIVEC_UNAVAIL 42
-#define BOOKE_INTERRUPT_ALTIVEC_ASSIST 43
-
/* book3s */
#define BOOK3S_INTERRUPT_SYSTEM_RESET 0x100
--
1.7.4.1
^ permalink raw reply related
* [RFC PATCH 5/6] KVM: PPC: Book3E: Add ONE_REG AltiVec support
From: Mihai Caraman @ 2013-06-03 20:54 UTC (permalink / raw)
To: kvm-ppc; +Cc: Mihai Caraman, linuxppc-dev, kvm
In-Reply-To: <1370292868-2697-1-git-send-email-mihai.caraman@freescale.com>
Add ONE_REG support for AltiVec on Book3E.
Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
---
arch/powerpc/kvm/booke.c | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 01eb635..019496d 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -1570,6 +1570,22 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
case KVM_REG_PPC_DEBUG_INST:
val = get_reg_val(reg->id, KVMPPC_INST_EHPRIV);
break;
+#ifdef CONFIG_ALTIVEC
+ case KVM_REG_PPC_VR0 ... KVM_REG_PPC_VR31:
+ if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
+ r = -ENXIO;
+ break;
+ }
+ val.vval = vcpu->arch.vr[reg->id - KVM_REG_PPC_VR0];
+ break;
+ case KVM_REG_PPC_VSCR:
+ if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
+ r = -ENXIO;
+ break;
+ }
+ val = get_reg_val(reg->id, vcpu->arch.vscr.u[3]);
+ break;
+#endif /* CONFIG_ALTIVEC */
default:
r = kvmppc_get_one_reg(vcpu, reg->id, &val);
break;
@@ -1643,6 +1659,22 @@ int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
kvmppc_set_tcr(vcpu, tcr);
break;
}
+#ifdef CONFIG_ALTIVEC
+ case KVM_REG_PPC_VR0 ... KVM_REG_PPC_VR31:
+ if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
+ r = -ENXIO;
+ break;
+ }
+ vcpu->arch.vr[reg->id - KVM_REG_PPC_VR0] = val.vval;
+ break;
+ case KVM_REG_PPC_VSCR:
+ if (!cpu_has_feature(CPU_FTR_ALTIVEC)) {
+ r = -ENXIO;
+ break;
+ }
+ vcpu->arch.vscr.u[3] = set_reg_val(reg->id, val);
+ break;
+#endif /* CONFIG_ALTIVEC */
default:
r = kvmppc_set_one_reg(vcpu, reg->id, &val);
break;
--
1.7.4.1
^ permalink raw reply related
* [RFC PATCH 2/6] KVM: PPC: Book3E: Refactor SPE_FP exit handling
From: Mihai Caraman @ 2013-06-03 20:54 UTC (permalink / raw)
To: kvm-ppc; +Cc: Mihai Caraman, linuxppc-dev, kvm
In-Reply-To: <1370292868-2697-1-git-send-email-mihai.caraman@freescale.com>
SPE_FP interrupts are shared with ALTIVEC. Refactor SPE_FP exit handling
to detect KVM support for the featured unit at run-time, in order to
accommodate ALTIVEC later.
Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
---
arch/powerpc/kvm/booke.c | 80 ++++++++++++++++++++++++++++++++++------------
1 files changed, 59 insertions(+), 21 deletions(-)
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 1020119..d082bbc 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -822,6 +822,15 @@ static void kvmppc_restart_interrupt(struct kvm_vcpu *vcpu,
}
}
+static inline bool kvmppc_supports_spe(void)
+{
+#ifdef CONFIG_SPE
+ if (cpu_has_feature(CPU_FTR_SPE))
+ return true;
+#endif
+ return false;
+}
+
/**
* kvmppc_handle_exit
*
@@ -931,42 +940,71 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
r = RESUME_GUEST;
break;
-#ifdef CONFIG_SPE
case BOOKE_INTERRUPT_SPE_UNAVAIL: {
- if (vcpu->arch.shared->msr & MSR_SPE)
- kvmppc_vcpu_enable_spe(vcpu);
- else
- kvmppc_booke_queue_irqprio(vcpu,
- BOOKE_IRQPRIO_SPE_UNAVAIL);
+ /*
+ * The interrupt is shared, KVM support for the featured unit
+ * is detected at run-time.
+ */
+ bool handled = false;
+
+ if (kvmppc_supports_spe()) {
+#ifdef CONFIG_SPE
+ if (cpu_has_feature(CPU_FTR_SPE))
+ if (vcpu->arch.shared->msr & MSR_SPE) {
+ kvmppc_vcpu_enable_spe(vcpu);
+ handled = true;
+ }
+#endif
+ if (!handled)
+ kvmppc_booke_queue_irqprio(vcpu,
+ BOOKE_IRQPRIO_SPE_UNAVAIL);
+ } else {
+ /*
+ * Guest wants SPE, but host kernel doesn't support it.
+ * Send an "unimplemented operation" program check to
+ * the guest.
+ */
+ kvmppc_core_queue_program(vcpu, ESR_PUO | ESR_SPV);
+ }
+
r = RESUME_GUEST;
break;
}
case BOOKE_INTERRUPT_SPE_FP_DATA:
- kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_SPE_FP_DATA);
- r = RESUME_GUEST;
+ /*
+ * The interrupt is shared, KVM support for the featured unit
+ * is detected at run-time.
+ */
+ if (kvmppc_supports_spe()) {
+ kvmppc_booke_queue_irqprio(vcpu,
+ BOOKE_IRQPRIO_SPE_FP_DATA);
+ r = RESUME_GUEST;
+ } else {
+ /*
+ * These really should never happen without CONFIG_SPE,
+ * as we should never enable the real MSR[SPE] in the
+ * guest.
+ */
+ printk(KERN_CRIT "%s: unexpected SPE interrupt %u at \
+ %08lx\n", __func__, exit_nr, vcpu->arch.pc);
+ run->hw.hardware_exit_reason = exit_nr;
+ r = RESUME_HOST;
+ }
+
break;
case BOOKE_INTERRUPT_SPE_FP_ROUND:
+#ifdef CONFIG_SPE
kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_SPE_FP_ROUND);
r = RESUME_GUEST;
break;
#else
- case BOOKE_INTERRUPT_SPE_UNAVAIL:
/*
- * Guest wants SPE, but host kernel doesn't support it. Send
- * an "unimplemented operation" program check to the guest.
+ * These really should never happen without CONFIG_SPE,
+ * as we should never enable the real MSR[SPE] in the
+ * guest.
*/
- kvmppc_core_queue_program(vcpu, ESR_PUO | ESR_SPV);
- r = RESUME_GUEST;
- break;
-
- /*
- * These really should never happen without CONFIG_SPE,
- * as we should never enable the real MSR[SPE] in the guest.
- */
- case BOOKE_INTERRUPT_SPE_FP_DATA:
- case BOOKE_INTERRUPT_SPE_FP_ROUND:
printk(KERN_CRIT "%s: unexpected SPE interrupt %u at %08lx\n",
__func__, exit_nr, vcpu->arch.pc);
run->hw.hardware_exit_reason = exit_nr;
--
1.7.4.1
^ permalink raw reply related
* [RFC PATCH 3/6] KVM: PPC: Book3E: Rename IRQPRIO names to accommodate ALTIVEC
From: Mihai Caraman @ 2013-06-03 20:54 UTC (permalink / raw)
To: kvm-ppc; +Cc: Mihai Caraman, linuxppc-dev, kvm
In-Reply-To: <1370292868-2697-1-git-send-email-mihai.caraman@freescale.com>
Rename BOOKE_IRQPRIO_SPE_UNAVAIL and BOOKE_IRQPRIO_SPE_FP_DATA names
to accommodate ALTIVEC. Replace BOOKE_INTERRUPT_SPE_UNAVAIL and
BOOKE_INTERRUPT_SPE_FP_DATA with the common version.
Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
---
arch/powerpc/kvm/booke.c | 12 ++++++------
arch/powerpc/kvm/booke.h | 4 ++--
arch/powerpc/kvm/bookehv_interrupts.S | 8 ++++----
arch/powerpc/kvm/e500.c | 10 ++++++----
arch/powerpc/kvm/e500_emulate.c | 8 ++++----
5 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index d082bbc..c08b04b 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -362,8 +362,8 @@ static int kvmppc_booke_irqprio_deliver(struct kvm_vcpu *vcpu,
case BOOKE_IRQPRIO_ITLB_MISS:
case BOOKE_IRQPRIO_SYSCALL:
case BOOKE_IRQPRIO_FP_UNAVAIL:
- case BOOKE_IRQPRIO_SPE_UNAVAIL:
- case BOOKE_IRQPRIO_SPE_FP_DATA:
+ case BOOKE_IRQPRIO_SPE_ALTIVEC_UNAVAIL:
+ case BOOKE_IRQPRIO_SPE_FP_DATA_ALTIVEC_ASSIST:
case BOOKE_IRQPRIO_SPE_FP_ROUND:
case BOOKE_IRQPRIO_AP_UNAVAIL:
allowed = 1;
@@ -940,7 +940,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
r = RESUME_GUEST;
break;
- case BOOKE_INTERRUPT_SPE_UNAVAIL: {
+ case BOOKE_INTERRUPT_SPE_ALTIVEC_UNAVAIL: {
/*
* The interrupt is shared, KVM support for the featured unit
* is detected at run-time.
@@ -957,7 +957,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
#endif
if (!handled)
kvmppc_booke_queue_irqprio(vcpu,
- BOOKE_IRQPRIO_SPE_UNAVAIL);
+ BOOKE_IRQPRIO_SPE_ALTIVEC_UNAVAIL);
} else {
/*
* Guest wants SPE, but host kernel doesn't support it.
@@ -971,14 +971,14 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
break;
}
- case BOOKE_INTERRUPT_SPE_FP_DATA:
+ case BOOKE_INTERRUPT_SPE_FP_DATA_ALTIVEC_ASSIST:
/*
* The interrupt is shared, KVM support for the featured unit
* is detected at run-time.
*/
if (kvmppc_supports_spe()) {
kvmppc_booke_queue_irqprio(vcpu,
- BOOKE_IRQPRIO_SPE_FP_DATA);
+ BOOKE_IRQPRIO_SPE_FP_DATA_ALTIVEC_ASSIST);
r = RESUME_GUEST;
} else {
/*
diff --git a/arch/powerpc/kvm/booke.h b/arch/powerpc/kvm/booke.h
index 5fd1ba6..9e92006 100644
--- a/arch/powerpc/kvm/booke.h
+++ b/arch/powerpc/kvm/booke.h
@@ -32,8 +32,8 @@
#define BOOKE_IRQPRIO_ALIGNMENT 2
#define BOOKE_IRQPRIO_PROGRAM 3
#define BOOKE_IRQPRIO_FP_UNAVAIL 4
-#define BOOKE_IRQPRIO_SPE_UNAVAIL 5
-#define BOOKE_IRQPRIO_SPE_FP_DATA 6
+#define BOOKE_IRQPRIO_SPE_ALTIVEC_UNAVAIL 5
+#define BOOKE_IRQPRIO_SPE_FP_DATA_ALTIVEC_ASSIST 6
#define BOOKE_IRQPRIO_SPE_FP_ROUND 7
#define BOOKE_IRQPRIO_SYSCALL 8
#define BOOKE_IRQPRIO_AP_UNAVAIL 9
diff --git a/arch/powerpc/kvm/bookehv_interrupts.S b/arch/powerpc/kvm/bookehv_interrupts.S
index e8ed7d6..8d35dc0 100644
--- a/arch/powerpc/kvm/bookehv_interrupts.S
+++ b/arch/powerpc/kvm/bookehv_interrupts.S
@@ -295,9 +295,9 @@ kvm_handler BOOKE_INTERRUPT_DTLB_MISS, EX_PARAMS_TLB, \
SPRN_SRR0, SPRN_SRR1, (NEED_EMU | NEED_DEAR | NEED_ESR)
kvm_handler BOOKE_INTERRUPT_ITLB_MISS, EX_PARAMS_TLB, \
SPRN_SRR0, SPRN_SRR1, 0
-kvm_handler BOOKE_INTERRUPT_SPE_UNAVAIL, EX_PARAMS(GEN), \
+kvm_handler BOOKE_INTERRUPT_SPE_ALTIVEC_UNAVAIL, EX_PARAMS(GEN), \
SPRN_SRR0, SPRN_SRR1, 0
-kvm_handler BOOKE_INTERRUPT_SPE_FP_DATA, EX_PARAMS(GEN), \
+kvm_handler BOOKE_INTERRUPT_SPE_FP_DATA_ALTIVEC_ASSIST, EX_PARAMS(GEN), \
SPRN_SRR0, SPRN_SRR1, 0
kvm_handler BOOKE_INTERRUPT_SPE_FP_ROUND, EX_PARAMS(GEN), \
SPRN_SRR0, SPRN_SRR1, 0
@@ -398,8 +398,8 @@ kvm_lvl_handler BOOKE_INTERRUPT_WATCHDOG, \
kvm_handler BOOKE_INTERRUPT_DTLB_MISS, \
SPRN_SRR0, SPRN_SRR1, (NEED_EMU | NEED_DEAR | NEED_ESR)
kvm_handler BOOKE_INTERRUPT_ITLB_MISS, SPRN_SRR0, SPRN_SRR1, 0
-kvm_handler BOOKE_INTERRUPT_SPE_UNAVAIL, SPRN_SRR0, SPRN_SRR1, 0
-kvm_handler BOOKE_INTERRUPT_SPE_FP_DATA, SPRN_SRR0, SPRN_SRR1, 0
+kvm_handler BOOKE_INTERRUPT_SPE_ALTIVEC_UNAVAIL, SPRN_SRR0, SPRN_SRR1, 0
+kvm_handler BOOKE_INTERRUPT_SPE_FP_DATA_ALTIVEC_ASSIST, SPRN_SRR0, SPRN_SRR1, 0
kvm_handler BOOKE_INTERRUPT_SPE_FP_ROUND, SPRN_SRR0, SPRN_SRR1, 0
kvm_handler BOOKE_INTERRUPT_PERFORMANCE_MONITOR, SPRN_SRR0, SPRN_SRR1, 0
kvm_handler BOOKE_INTERRUPT_DOORBELL, SPRN_SRR0, SPRN_SRR1, 0
diff --git a/arch/powerpc/kvm/e500.c b/arch/powerpc/kvm/e500.c
index ce6b73c..0fb2f4d 100644
--- a/arch/powerpc/kvm/e500.c
+++ b/arch/powerpc/kvm/e500.c
@@ -380,8 +380,10 @@ void kvmppc_core_get_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
sregs->u.e.impl.fsl.hid0 = vcpu_e500->hid0;
sregs->u.e.impl.fsl.mcar = vcpu_e500->mcar;
- sregs->u.e.ivor_high[0] = vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_UNAVAIL];
- sregs->u.e.ivor_high[1] = vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_FP_DATA];
+ sregs->u.e.ivor_high[0] =
+ vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_ALTIVEC_UNAVAIL];
+ sregs->u.e.ivor_high[1] =
+ vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_FP_DATA_ALTIVEC_ASSIST];
sregs->u.e.ivor_high[2] = vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_FP_ROUND];
sregs->u.e.ivor_high[3] =
vcpu->arch.ivor[BOOKE_IRQPRIO_PERFORMANCE_MONITOR];
@@ -409,9 +411,9 @@ int kvmppc_core_set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
return 0;
if (sregs->u.e.features & KVM_SREGS_E_SPE) {
- vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_UNAVAIL] =
+ vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_ALTIVEC_UNAVAIL] =
sregs->u.e.ivor_high[0];
- vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_FP_DATA] =
+ vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_FP_DATA_ALTIVEC_ASSIST] =
sregs->u.e.ivor_high[1];
vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_FP_ROUND] =
sregs->u.e.ivor_high[2];
diff --git a/arch/powerpc/kvm/e500_emulate.c b/arch/powerpc/kvm/e500_emulate.c
index b10a012..b2e159b 100644
--- a/arch/powerpc/kvm/e500_emulate.c
+++ b/arch/powerpc/kvm/e500_emulate.c
@@ -211,10 +211,10 @@ int kvmppc_core_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
/* extra exceptions */
case SPRN_IVOR32:
- vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_UNAVAIL] = spr_val;
+ vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_ALTIVEC_UNAVAIL] = spr_val;
break;
case SPRN_IVOR33:
- vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_FP_DATA] = spr_val;
+ vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_FP_DATA_ALTIVEC_ASSIST] = spr_val;
break;
case SPRN_IVOR34:
vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_FP_ROUND] = spr_val;
@@ -329,10 +329,10 @@ int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val)
/* extra exceptions */
case SPRN_IVOR32:
- *spr_val = vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_UNAVAIL];
+ *spr_val = vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_ALTIVEC_UNAVAIL];
break;
case SPRN_IVOR33:
- *spr_val = vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_FP_DATA];
+ *spr_val = vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_FP_DATA_ALTIVEC_ASSIST];
break;
case SPRN_IVOR34:
*spr_val = vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_FP_ROUND];
--
1.7.4.1
^ permalink raw reply related
* [RFC PATCH 4/6] KVM: PPC: Book3E: Add AltiVec support
From: Mihai Caraman @ 2013-06-03 20:54 UTC (permalink / raw)
To: kvm-ppc; +Cc: Mihai Caraman, linuxppc-dev, kvm
In-Reply-To: <1370292868-2697-1-git-send-email-mihai.caraman@freescale.com>
KVM Book3E FPU support gracefully reuse host infrastructure so we do the
same for AltiVec. To keep AltiVec lazy call kvmppc_load_guest_altivec()
just when returning to guest instead of each sched in.
Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
---
arch/powerpc/kvm/booke.c | 74 +++++++++++++++++++++++++++++++++++++++++++-
arch/powerpc/kvm/e500mc.c | 8 +++++
2 files changed, 80 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index c08b04b..01eb635 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -134,6 +134,23 @@ static void kvmppc_vcpu_sync_fpu(struct kvm_vcpu *vcpu)
}
/*
+ * Simulate AltiVec unavailable fault to load guest state
+ * from thread to AltiVec unit.
+ * It requires to be called with preemption disabled.
+ */
+static inline void kvmppc_load_guest_altivec(struct kvm_vcpu *vcpu)
+{
+#ifdef CONFIG_ALTIVEC
+ if (cpu_has_feature(CPU_FTR_ALTIVEC)) {
+ if (!(current->thread.regs->msr & MSR_VEC)) {
+ load_up_altivec(NULL);
+ current->thread.regs->msr |= MSR_VEC;
+ }
+ }
+#endif
+}
+
+/*
* Helper function for "full" MSR writes. No need to call this if only
* EE/CE/ME/DE/RI are changing.
*/
@@ -661,6 +678,12 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
u64 fpr[32];
#endif
+#ifdef CONFIG_ALTIVEC
+ vector128 vr[32];
+ vector128 vscr;
+ int used_vr = 0;
+#endif
+
if (!vcpu->arch.sane) {
kvm_run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
return -EINVAL;
@@ -699,6 +722,22 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
kvmppc_load_guest_fp(vcpu);
#endif
+#ifdef CONFIG_ALTIVEC
+ if (cpu_has_feature(CPU_FTR_ALTIVEC)) {
+ /* Save userspace VEC state in stack */
+ enable_kernel_altivec();
+ memcpy(vr, current->thread.vr, sizeof(current->thread.vr));
+ vscr = current->thread.vscr;
+ used_vr = current->thread.used_vr;
+
+ /* Restore guest VEC state to thread */
+ memcpy(current->thread.vr, vcpu->arch.vr, sizeof(vcpu->arch.vr));
+ current->thread.vscr = vcpu->arch.vscr;
+
+ kvmppc_load_guest_altivec(vcpu);
+ }
+#endif
+
ret = __kvmppc_vcpu_run(kvm_run, vcpu);
/* No need for kvm_guest_exit. It's done in handle_exit.
@@ -719,6 +758,23 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
current->thread.fpexc_mode = fpexc_mode;
#endif
+#ifdef CONFIG_ALTIVEC
+ if (cpu_has_feature(CPU_FTR_ALTIVEC)) {
+ /* Save AltiVec state to thread */
+ if (current->thread.regs->msr & MSR_VEC)
+ giveup_altivec(current);
+
+ /* Save guest state */
+ memcpy(vcpu->arch.vr, current->thread.vr, sizeof(vcpu->arch.vr));
+ vcpu->arch.vscr = current->thread.vscr;
+
+ /* Restore userspace state */
+ memcpy(current->thread.vr, vr, sizeof(current->thread.vr));
+ current->thread.vscr = vscr;
+ current->thread.used_vr = used_vr;
+ }
+#endif
+
out:
vcpu->mode = OUTSIDE_GUEST_MODE;
return ret;
@@ -822,6 +878,19 @@ static void kvmppc_restart_interrupt(struct kvm_vcpu *vcpu,
}
}
+/*
+ * Always returns true is AltiVec unit is present, see
+ * kvmppc_core_check_processor_compat().
+ */
+static inline bool kvmppc_supports_altivec(void)
+{
+#ifdef CONFIG_ALTIVEC
+ if (cpu_has_feature(CPU_FTR_ALTIVEC))
+ return true;
+#endif
+ return false;
+}
+
static inline bool kvmppc_supports_spe(void)
{
#ifdef CONFIG_SPE
@@ -947,7 +1016,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
*/
bool handled = false;
- if (kvmppc_supports_spe()) {
+ if (kvmppc_supports_altivec() || kvmppc_supports_spe()) {
#ifdef CONFIG_SPE
if (cpu_has_feature(CPU_FTR_SPE))
if (vcpu->arch.shared->msr & MSR_SPE) {
@@ -976,7 +1045,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
* The interrupt is shared, KVM support for the featured unit
* is detected at run-time.
*/
- if (kvmppc_supports_spe()) {
+ if (kvmppc_supports_altivec() || kvmppc_supports_spe()) {
kvmppc_booke_queue_irqprio(vcpu,
BOOKE_IRQPRIO_SPE_FP_DATA_ALTIVEC_ASSIST);
r = RESUME_GUEST;
@@ -1188,6 +1257,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
r = (s << 2) | RESUME_HOST | (r & RESUME_FLAG_NV);
} else {
kvmppc_lazy_ee_enable();
+ kvmppc_load_guest_altivec(vcpu);
}
}
diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c
index c3bdc0a..9d7f38e 100644
--- a/arch/powerpc/kvm/e500mc.c
+++ b/arch/powerpc/kvm/e500mc.c
@@ -172,8 +172,16 @@ int kvmppc_core_check_processor_compat(void)
r = 0;
else if (strcmp(cur_cpu_spec->cpu_name, "e5500") == 0)
r = 0;
+#ifdef CONFIG_ALTIVEC
+ /*
+ * Since guests have the priviledge to enable AltiVec, we need AltiVec
+ * support in the host to save/restore their context.
+ * Don't use CPU_FTR_ALTIVEC to identify cores with AltiVec unit
+ * because it's cleared in the absence of CONFIG_ALTIVEC!
+ */
else if (strcmp(cur_cpu_spec->cpu_name, "e6500") == 0)
r = 0;
+#endif
else
r = -ENOTSUPP;
--
1.7.4.1
^ permalink raw reply related
* [RFC PATCH 0/6] KVM: PPC: Book3E: AltiVec support
From: Mihai Caraman @ 2013-06-03 20:54 UTC (permalink / raw)
To: kvm-ppc; +Cc: Mihai Caraman, linuxppc-dev, kvm
Mihai Caraman (6):
KVM: PPC: Book3E: Fix AltiVec interrupt numbers and build breakage
KVM: PPC: Book3E: Refactor SPE_FP exit handling
KVM: PPC: Book3E: Rename IRQPRIO names to accommodate ALTIVEC
KVM: PPC: Book3E: Add AltiVec support
KVM: PPC: Book3E: Add ONE_REG AltiVec support
KVM: PPC: Book3E: Enhance FPU laziness
arch/powerpc/include/asm/kvm_asm.h | 16 ++-
arch/powerpc/kvm/booke.c | 189 ++++++++++++++++++++++++++++----
arch/powerpc/kvm/booke.h | 4 +-
arch/powerpc/kvm/bookehv_interrupts.S | 8 +-
arch/powerpc/kvm/e500.c | 10 +-
arch/powerpc/kvm/e500_emulate.c | 8 +-
arch/powerpc/kvm/e500mc.c | 10 ++-
7 files changed, 199 insertions(+), 46 deletions(-)
--
1.7.4.1
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox