* Re: [PATCH] powerpc/pci: Fix IO space breakage after of_pci_range_to_resource() change
From: arnd @ 2014-10-16 14:05 UTC (permalink / raw)
To: linuxppc-dev, Michael Ellerman
Cc: bhelgaas, linus.walleij, Liviu.Dudau, linux-kernel
In-Reply-To: <1413429775-716-1-git-send-email-mpe@ellerman.id.au>
(hope my email makes it everywhere, using a webmail client at the moment as=
I'm
at plumbersconf
Michael Ellerman <mpe@ellerman.id.au> hat am 16. Oktober 2014 um 05:22
geschrieben:
>
>
> Commit 0b0b0893d49b "of/pci: Fix the conversion of IO ranges into IO
> resources" changed the behaviour of of_pci_range_to_resource().
I just looked at this after benh mentioned the problem on IRC, here's a log=
dump
:26 AM <benh> argh =20
9:27 AM <benh> the whole ARM OF PCI rework seems to completely break PIO =
on
powerpc =20
9:30 AM =E2=86=92 willy <willy> joined (^willy@62.156.150.204) =20
9:35 AM <benh> and reverting it would mean reverting all of ARM new PCI s=
tuff
=20
9:35 AM <benh> crap =20
9:35 AM <benh> that business with IO space allocation taking over our cod=
e
without understanding what it does =20
9:35 AM <benh> yuck =20
9:41 AM =E2=86=92 markf <markf> , olaf <olaf> , sarnold <sarnold> , gos=
po <gospo> ,
cmarinas <cmarinas> , Mahesh1 <Mahesh1> , joern <joern> , clark_ <clark_> a=
nd
benhjoined =E2=87=90 gcl <gcl> and clark <clark> quit =E2=86=94 willy <wi=
lly> , jbarnes
<jbarnes> , jbrandeb_ <jbrandeb_> and Mahesh <Mahesh> popped in =E2=86=94 =
sameo <sameo>
, jbrandeb <jbrandeb> , steved <steved> and jj <jj> nipped out =E2=80=A2 =
srikar =E2=86=92
srikar_away <srikar_away> , raghu =E2=86=92 raghu_away <raghu_away> =20
Thursday, October 16th, 2014 =20
12:06 AM =E2=86=92 fweisbec <fweisbec> , Mahesh <Mahesh> , kamalesh <ka=
malesh> ,
heiko <heiko> , olaf <olaf> , riel <riel> and willy <willy> joined =E2=87=
=90 shaggy
<shaggy> , sammj <sammj> , sameo <sameo> , clark_ <clark_> , lenb <lenb> an=
d jj
<jj> quit =E2=86=94 jbrandeb <jbrandeb> , cdub <cdub> , Mahesh1 <Mahesh1> =
and gcl <gcl>
popped in =E2=86=94 jbrandeb_ <jbrandeb_> , benh, joern <joern> and BenC <=
BenC> nipped
out =E2=80=A2 mpe|away =E2=86=92 mpe|away <mpe%7Caway> , raghu_away =E2=
=86=92 raghu <raghu> ,
srikar_away =E2=86=92 srikar <srikar> =20
10:16 AM <arnd_> benh: is it the of_pci_range_to_resource change? =20
10:17 AM <arnd_> the new pci_ioremap_iospace logic should not get used on
powerpc at all, so I didn't expect any breakage =20
10:18 AM <arnd_> I wasn't too happy with all the details of Liviu's serie=
s,
bit in the end it seemed reasonable enough =20
10:20 AM <arnd_> he really wanted to use the pci_address_to_pio code from
powerpc and in the end I stopped complaining =20
10:21 AM <arnd_> the new code can do a few things that simpler versions c=
ould
not, e.g. handling multiple host bridges getting registered when they have =
the
same I/O space window =20
10:23 AM =E2=86=92 jj <jj> joined (^jj@static-50-53-60-87.bvtn.or.frontie=
rnet.net) =20
10:33 AM <arnd_> benh: I can see how it breaks your
pci_process_bridge_OF_ranges, we had the same problem in some of the ARM
platforms and Liviu fixed those but apparently didn't realize he had to cha=
nge
the ppc implementation (and get your ack) too =20
10:35 AM <arnd_> the good news is that it should in fact simplify your co=
de to
fix it, but the fact that this bug got into the kernel in the first place i=
s
extremely annoying =20
10:39 AM <arnd_> benh: the fixup that is done in your
pcibios_reserve_legacy_regions is now already performed in
of_pci_range_to_resource =20
10:39 AM <arnd_> we had duplicated the same thing in each pci host driver=
(and
they all got it wrong), so the intent was to move it into a common place =
=20
10:40 AM <arnd_> but of course it's a bug to do it twice =20
10:43 AM <arnd_> pci_register_io_range is trying to do a more generalized
version of how you assign hose->io_base_virt, you should probably override =
that
to keep the current behavior =20
10:45 AM <arnd_> pcibios_map_phb_io_space I mean, for ppc64 =20
10:52 AM =E2=86=92 cmarinas <cmarinas> joined (~cmarinas@fw-tnat.cambridg=
e.arm.com) =20
10:53 AM <arnd_> benh: for 3.18, the best approach is likely to #ifdef
<%23ifdef> PCI_IOBASE the changes in of_pci_range_to_resource =20
10:54 AM <arnd_> I suspect you are fine with effectively reverting Liviu'=
s
changes that way, and you can decide whether or not you want to later make =
the
powerpc code use the common logic =20
11:01 AM =E2=86=92 cdub <cdub> and sarnold <sarnold> joined =E2=87=90 =
cmarinas <cmarinas>
quit =20
11:28 AM <benh> arnd_: can you shoot the above in an email CCed to mpe ? =
=20
11:28 AM <benh> arnd_: he did a band aid that works =20
11:28 AM <benh> arnd_: and see the comment I made today about using his s=
tuff
if I can specify where I want the IO ranges =20
11:28 AM <benh> arnd_: I want to keep the way I do the layout on ppc64 =
=20
> Previously it simply populated the resource based on the arguments. Now
> it calls pci_register_io_range() and pci_address_to_pio(). These both
> have two implementations depending on whether PCI_IOBASE is defined,
> which it is not for powerpc.
>
> Further complicating matters, both routines are weak, and powerpc
> implements it's own version of one - pci_address_to_pio(). However
> powerpc's implementation depends on other initialisations which are done
> later in boot.
Right, sorry for missing this during the last review of the broken patches.
> The end result is incorrectly initialised IO space. Often we can get
> away with that, because we don't make much use of IO space. However
> virtio requires it, so we see eg:
>
> pci_bus 0000:00: root bus resource [io 0xffff] (bus address
> [0xffffffffffffffff-0xffffffffffffffff])
> PCI: Cannot allocate resource region 0 of device 0000:00:01.0, will remap
> virtio-pci 0000:00:01.0: can't enable device: BAR 0 [io size 0x0020] not
> assigned
>
> The simplest fix for now is to just stop using of_pci_range_to_resource()=
,
> and open-code the original imp`lementation, that's all we want it to do.
The same bug is likely to be present on microblaze and mips, which may or m=
ay
not
care about it. I'll ask Michal about whether microblaze actually has any
I/O space, otherwise we have to fix it too for 3.18.
I believe for 3.19, we should probably migrate microblaze over to use the s=
ame
code
as ARM.
> Fixes: 0b0b0893d49b ("of/pci: Fix the conversion of IO ranges into IO
> resources")
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
> arch/powerpc/kernel/pci-common.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/kernel/pci-common.c
> b/arch/powerpc/kernel/pci-common.c
> index bd70a51d5747..e5dad9a9edc0 100644
> --- a/arch/powerpc/kernel/pci-common.c
> +++ b/arch/powerpc/kernel/pci-common.c
> @@ -747,7 +747,11 @@ void pci_process_bridge_OF_ranges(struct pci_control=
ler
> *hose,
> break;
> }
> if (res !=3D NULL) {
> - of_pci_range_to_resource(&range, dev, res);
> + res->name =3D dev->full_name;
> + res->flags =3D range.flags;
> + res->start =3D range.cpu_addr;
> + res->end =3D range.cpu_addr + range.size - 1;
> + res->parent =3D res->child =3D res->sibling =3D NULL;
> }
> }
This looks reasonable to me as a hack to work around the breakage. It would=
be
good
to work together on this for 3.19 to move on to the a common implementation=
that
works on both ARM and PowerPC. This might be possibly by removing a lot of =
code
for PowerPC (at least 64-bit) that is now present in common code, but it wi=
ll
change the structure of the powerpc implementation significantly, since the
returned numbers are now in different memory spaces (logical I/O space rath=
er
than physical). The PowerPC _IO_BASE is the equivalent of the now generic
PCI_IOBASE,
but it's used slightly differently. If you want to use the generic code,=20
you should probably change host->io_base_virt to host->io_base in logical
space (i.e. removing the _IO_BASE offset), or using hose->io_resource.start
instead.
Arnd
^ permalink raw reply
* Re: [PATCH v3 22/27] s390/MSI: Use MSI chip framework to configure MSI/MSI-X irq
From: Sebastian Ott @ 2014-10-16 12:13 UTC (permalink / raw)
To: Yijing Wang
Cc: linux-mips, linux-ia64, linux-pci, Bharat.Bhushan, Thierry Reding,
sparclinux, linux-arch, linux-s390, Russell King, Joerg Roedel,
x86, xen-devel, arnab.basu, Liviu Dudau, Arnd Bergmann,
Konrad Rzeszutek Wilk, Chris Metcalf, Bjorn Helgaas,
Thomas Gleixner, linux-arm-kernel, Thomas Petazzoni, Xinwei Hu,
Tony Luck, Sergei Shtylyov, linux-kernel, Ralf Baechle, iommu,
David Vrabel, Wuyun, linuxppc-dev, David S. Miller, Lucas Stach
In-Reply-To: <1413342435-7876-23-git-send-email-wangyijing@huawei.com>
On Wed, 15 Oct 2014, Yijing Wang wrote:
> Use MSI chip framework instead of arch MSI functions to configure
> MSI/MSI-X irq. So we can manage MSI/MSI-X irq in a unified framework.
>
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> ---
> Hi Sebastian,
> I dropped the Acked-by , because this version has a
> lot changes compared to last. So, I guess you may want to check it again.
I did and I agree with that one too.
Regards,
Sebastian
> ---
> arch/s390/include/asm/pci.h | 9 +++++++++
> arch/s390/pci/pci.c | 12 ++++++++++--
> 2 files changed, 19 insertions(+), 2 deletions(-)
>
> diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h
> index c030900..4d41f08 100644
> --- a/arch/s390/include/asm/pci.h
> +++ b/arch/s390/include/asm/pci.h
> @@ -88,6 +88,8 @@ struct zpci_dev {
> u32 uid; /* user defined id */
> u8 util_str[CLP_UTIL_STR_LEN]; /* utility string */
>
> + struct msi_chip *msi_chip;
> +
> /* IRQ stuff */
> u64 msi_addr; /* MSI address */
> struct airq_iv *aibv; /* adapter interrupt bit vector */
> @@ -121,6 +123,13 @@ struct zpci_dev {
> struct dentry *debugfs_perf;
> };
>
> +static inline struct msi_chip *pci_msi_chip(struct pci_bus *bus)
> +{
> + struct zpci_dev *zpci = bus->sysdata;
> +
> + return zpci->msi_chip;
> +}
> +
> static inline bool zdev_enabled(struct zpci_dev *zdev)
> {
> return (zdev->fh & (1UL << 31)) ? true : false;
> diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
> index 552b990..bf6732f 100644
> --- a/arch/s390/pci/pci.c
> +++ b/arch/s390/pci/pci.c
> @@ -358,7 +358,8 @@ static void zpci_irq_handler(struct airq_struct *airq)
> }
> }
>
> -int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
> +static int zpci_setup_msi_irqs(struct msi_chip *chip,
> + struct pci_dev *pdev, int nvec, int type)
> {
> struct zpci_dev *zdev = get_zdev(pdev);
> unsigned int hwirq, msi_vecs;
> @@ -434,7 +435,8 @@ out:
> return rc;
> }
>
> -void arch_teardown_msi_irqs(struct pci_dev *pdev)
> +static void zpci_teardown_msi_irqs(struct msi_chip *chip,
> + struct pci_dev *pdev)
> {
> struct zpci_dev *zdev = get_zdev(pdev);
> struct msi_desc *msi;
> @@ -464,6 +466,11 @@ void arch_teardown_msi_irqs(struct pci_dev *pdev)
> airq_iv_free_bit(zpci_aisb_iv, zdev->aisb);
> }
>
> +static struct msi_chip zpci_msi_chip = {
> + .setup_irqs = zpci_setup_msi_irqs,
> + .teardown_irqs = zpci_teardown_msi_irqs,
> +};
> +
> static void zpci_map_resources(struct zpci_dev *zdev)
> {
> struct pci_dev *pdev = zdev->pdev;
> @@ -749,6 +756,7 @@ static int zpci_scan_bus(struct zpci_dev *zdev)
> if (ret)
> return ret;
>
> + zdev->msi_chip = &zpci_msi_chip;
> zdev->bus = pci_scan_root_bus(NULL, ZPCI_BUS_NR, &pci_root_ops,
> zdev, &resources);
> if (!zdev->bus) {
> --
> 1.7.1
>
>
^ permalink raw reply
* [PATCH 2/2] clk: ppc-corenet: don't use platform_driver to init the clock device
From: Kevin Hao @ 2014-10-16 11:18 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Scott Wood, Mike Turquette, Jingchang Lu
In-Reply-To: <1413458321-23880-1-git-send-email-haokexin@gmail.com>
In commit da788acb2838 ("clk: ppc-corenet: Fix Section mismatch
warning"), we put the ppc_corenet_clk_driver struct to init section
in order to fix section mismatch warning. This is definitely wrong
because the kernel would free the memories occupied by
ppc_corenet_clk_driver after boot while this driver is still registered
in the driver core. The kernel would panic when accessing this driver
struct. So choose to use CLK_OF_DECLARE to scan and init the clock devices.
Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
arch/powerpc/platforms/85xx/corenet_generic.c | 7 +++++
drivers/clk/clk-ppc-corenet.c | 43 ++++-----------------------
2 files changed, 13 insertions(+), 37 deletions(-)
diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c b/arch/powerpc/platforms/85xx/corenet_generic.c
index e56b89a792ed..7677cfecb787 100644
--- a/arch/powerpc/platforms/85xx/corenet_generic.c
+++ b/arch/powerpc/platforms/85xx/corenet_generic.c
@@ -16,6 +16,7 @@
#include <linux/kdev_t.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
+#include <linux/clk-provider.h>
#include <asm/time.h>
#include <asm/machdep.h>
@@ -188,11 +189,17 @@ static int __init corenet_generic_probe(void)
return 0;
}
+static void __init corenet_gen_init(void)
+{
+ of_clk_init(NULL);
+}
+
define_machine(corenet_generic) {
.name = "CoreNet Generic",
.probe = corenet_generic_probe,
.setup_arch = corenet_gen_setup_arch,
.init_IRQ = corenet_gen_pic_init,
+ .init = corenet_gen_init,
#ifdef CONFIG_PCI
.pcibios_fixup_bus = fsl_pcibios_fixup_bus,
.pcibios_fixup_phb = fsl_pcibios_fixup_phb,
diff --git a/drivers/clk/clk-ppc-corenet.c b/drivers/clk/clk-ppc-corenet.c
index 8e58edfeeb37..bf0fe565ce4e 100644
--- a/drivers/clk/clk-ppc-corenet.c
+++ b/drivers/clk/clk-ppc-corenet.c
@@ -268,40 +268,9 @@ static void __init sysclk_init(struct device_node *node)
of_clk_add_provider(np, of_clk_src_simple_get, clk);
}
-static const struct of_device_id clk_match[] __initconst = {
- { .compatible = "fsl,qoriq-sysclk-1.0", .data = sysclk_init, },
- { .compatible = "fsl,qoriq-sysclk-2.0", .data = sysclk_init, },
- { .compatible = "fsl,qoriq-core-pll-1.0", .data = core_pll_init, },
- { .compatible = "fsl,qoriq-core-pll-2.0", .data = core_pll_init, },
- { .compatible = "fsl,qoriq-core-mux-1.0", .data = core_mux_init, },
- { .compatible = "fsl,qoriq-core-mux-2.0", .data = core_mux_init, },
- {}
-};
-
-static int __init ppc_corenet_clk_probe(struct platform_device *pdev)
-{
- of_clk_init(clk_match);
-
- return 0;
-}
-
-static const struct of_device_id ppc_clk_ids[] __initconst = {
- { .compatible = "fsl,qoriq-clockgen-1.0", },
- { .compatible = "fsl,qoriq-clockgen-2.0", },
- {}
-};
-
-static struct platform_driver ppc_corenet_clk_driver __initdata = {
- .driver = {
- .name = "ppc_corenet_clock",
- .owner = THIS_MODULE,
- .of_match_table = ppc_clk_ids,
- },
- .probe = ppc_corenet_clk_probe,
-};
-
-static int __init ppc_corenet_clk_init(void)
-{
- return platform_driver_register(&ppc_corenet_clk_driver);
-}
-subsys_initcall(ppc_corenet_clk_init);
+CLK_OF_DECLARE(qoriq_sysclk_1, "fsl,qoriq-sysclk-1.0", sysclk_init);
+CLK_OF_DECLARE(qoriq_sysclk_2, "fsl,qoriq-sysclk-2.0", sysclk_init);
+CLK_OF_DECLARE(qoriq_core_pll_1, "fsl,qoriq-core-pll-1.0", core_pll_init);
+CLK_OF_DECLARE(qoriq_core_pll_2, "fsl,qoriq-core-pll-2.0", core_pll_init);
+CLK_OF_DECLARE(qoriq_core_mux_1, "fsl,qoriq-core-mux-1.0", core_mux_init);
+CLK_OF_DECLARE(qoriq_core_mux_2, "fsl,qoriq-core-mux-2.0", core_mux_init);
--
1.9.3
^ permalink raw reply related
* [PATCH 1/2] powerpc: move ppc_init() to common place
From: Kevin Hao @ 2014-10-16 11:18 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Scott Wood, Mike Turquette, Jingchang Lu
In-Reply-To: <1413458321-23880-1-git-send-email-haokexin@gmail.com>
So they can be used by ppc64 board. Also remove the unneeded {} to
make checkpatch happy.
Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
arch/powerpc/include/asm/machdep.h | 2 +-
arch/powerpc/kernel/setup-common.c | 15 +++++++++++++++
arch/powerpc/kernel/setup_32.c | 15 ---------------
3 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index 307347f8ddbd..4b913d53333b 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -213,11 +213,11 @@ struct machdep_calls {
int (*set_dawr)(unsigned long dawr,
unsigned long dawrx);
-#ifdef CONFIG_PPC32 /* XXX for now */
/* A general init function, called by ppc_init in init/main.c.
May be NULL. */
void (*init)(void);
+#ifdef CONFIG_PPC32 /* XXX for now */
void (*kgdb_map_scc)(void);
/*
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 1362cd62b3fa..f76d4a1dbe73 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -750,3 +750,18 @@ void arch_setup_pdev_archdata(struct platform_device *pdev)
pdev->dev.dma_mask = &pdev->archdata.dma_mask;
set_dma_ops(&pdev->dev, &dma_direct_ops);
}
+
+int __init ppc_init(void)
+{
+ /* clear the progress line */
+ if (ppc_md.progress)
+ ppc_md.progress(" ", 0xffff);
+
+ /* call platform init */
+ if (ppc_md.init != NULL)
+ ppc_md.init();
+
+ return 0;
+}
+
+arch_initcall(ppc_init);
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 07831ed0d9ef..59d8c6e15782 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -208,21 +208,6 @@ EXPORT_SYMBOL(nvram_sync);
#endif /* CONFIG_NVRAM */
-int __init ppc_init(void)
-{
- /* clear the progress line */
- if (ppc_md.progress)
- ppc_md.progress(" ", 0xffff);
-
- /* call platform init */
- if (ppc_md.init != NULL) {
- ppc_md.init();
- }
- return 0;
-}
-
-arch_initcall(ppc_init);
-
static void __init irqstack_early_init(void)
{
unsigned int i;
--
1.9.3
^ permalink raw reply related
* [PATCH 0/2] fix a kernel panic on fsl corenet board when CONFIG_CLK_PPC_CORENET is enabled
From: Kevin Hao @ 2014-10-16 11:18 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Scott Wood, Mike Turquette, Jingchang Lu
Hi,
This tries to fix a kernel panic introduced by commit da788acb2838
("clk: ppc-corenet: Fix Section mismatch warning").
Kevin Hao (2):
powerpc: move ppc_init() to common place
clk: ppc-corenet: don't use platform_driver to init the clock device
arch/powerpc/include/asm/machdep.h | 2 +-
arch/powerpc/kernel/setup-common.c | 15 ++++++++++
arch/powerpc/kernel/setup_32.c | 15 ----------
arch/powerpc/platforms/85xx/corenet_generic.c | 7 +++++
drivers/clk/clk-ppc-corenet.c | 43 ++++-----------------------
5 files changed, 29 insertions(+), 53 deletions(-)
--
1.9.3
^ permalink raw reply
* [PATCH v2 26/53] dmaengine: fsl-dma: Split device_control
From: Maxime Ripard @ 2014-10-16 10:17 UTC (permalink / raw)
To: dmaengine, Vinod Koul
Cc: lars, Russell King, linux-kernel, Zhang Wei, Laurent Pinchart,
Maxime Ripard, linuxppc-dev, Dan Williams, linux-arm-kernel,
Antoine Ténart
In-Reply-To: <1413454672-27400-1-git-send-email-maxime.ripard@free-electrons.com>
Split the device_control callback of the Freescale Elo DMA driver to make use
of the newly introduced callbacks, that will eventually be used to retrieve
slave capabilities.
While we're at it, remove the useless prep_sg callback.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
drivers/dma/fsldma.c | 100 ++++++++++++++++++++++++---------------------------
1 file changed, 46 insertions(+), 54 deletions(-)
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index d5d6885ab341..4da5b4dcb45c 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -927,35 +927,7 @@ fail:
return NULL;
}
-/**
- * fsl_dma_prep_slave_sg - prepare descriptors for a DMA_SLAVE transaction
- * @chan: DMA channel
- * @sgl: scatterlist to transfer to/from
- * @sg_len: number of entries in @scatterlist
- * @direction: DMA direction
- * @flags: DMAEngine flags
- * @context: transaction context (ignored)
- *
- * Prepare a set of descriptors for a DMA_SLAVE transaction. Following the
- * DMA_SLAVE API, this gets the device-specific information from the
- * chan->private variable.
- */
-static struct dma_async_tx_descriptor *fsl_dma_prep_slave_sg(
- struct dma_chan *dchan, struct scatterlist *sgl, unsigned int sg_len,
- enum dma_transfer_direction direction, unsigned long flags,
- void *context)
-{
- /*
- * This operation is not supported on the Freescale DMA controller
- *
- * However, we need to provide the function pointer to allow the
- * device_control() method to work.
- */
- return NULL;
-}
-
-static int fsl_dma_device_control(struct dma_chan *dchan,
- enum dma_ctrl_cmd cmd, unsigned long arg)
+static int fsl_dma_device_terminate_all(struct dma_chan *dchan)
{
struct dma_slave_config *config;
struct fsldma_chan *chan;
@@ -966,38 +938,57 @@ static int fsl_dma_device_control(struct dma_chan *dchan,
chan = to_fsl_chan(dchan);
- switch (cmd) {
- case DMA_TERMINATE_ALL:
- spin_lock_bh(&chan->desc_lock);
+ spin_lock_bh(&chan->desc_lock);
+
+ /* Halt the DMA engine */
+ dma_halt(chan);
- /* Halt the DMA engine */
- dma_halt(chan);
+ /* Remove and free all of the descriptors in the LD queue */
+ fsldma_free_desc_list(chan, &chan->ld_pending);
+ fsldma_free_desc_list(chan, &chan->ld_running);
+ fsldma_free_desc_list(chan, &chan->ld_completed);
+ chan->idle = true;
- /* Remove and free all of the descriptors in the LD queue */
- fsldma_free_desc_list(chan, &chan->ld_pending);
- fsldma_free_desc_list(chan, &chan->ld_running);
- fsldma_free_desc_list(chan, &chan->ld_completed);
- chan->idle = true;
+ spin_unlock_bh(&chan->desc_lock);
+ return 0;
+}
- spin_unlock_bh(&chan->desc_lock);
- return 0;
+static int fsl_dma_device_config(struct dma_chan *dchan,
+ struct dma_slave_config *config)
+{
+ struct fsldma_chan *chan;
+ int size;
- case DMA_SLAVE_CONFIG:
- config = (struct dma_slave_config *)arg;
+ if (!dchan)
+ return -EINVAL;
- /* make sure the channel supports setting burst size */
- if (!chan->set_request_count)
- return -ENXIO;
+ chan = to_fsl_chan(dchan);
- /* we set the controller burst size depending on direction */
- if (config->direction == DMA_MEM_TO_DEV)
- size = config->dst_addr_width * config->dst_maxburst;
- else
- size = config->src_addr_width * config->src_maxburst;
+ /* make sure the channel supports setting burst size */
+ if (!chan->set_request_count)
+ return -ENXIO;
- chan->set_request_count(chan, size);
- return 0;
+ /* we set the controller burst size depending on direction */
+ if (config->direction == DMA_MEM_TO_DEV)
+ size = config->dst_addr_width * config->dst_maxburst;
+ else
+ size = config->src_addr_width * config->src_maxburst;
+ chan->set_request_count(chan, size);
+ return 0;
+}
+
+static int fsl_dma_device_control(struct dma_chan *dchan,
+ enum dma_ctrl_cmd cmd, unsigned long arg)
+{
+ struct fsldma_chan *chan;
+
+ if (!dchan)
+ return -EINVAL;
+
+ chan = to_fsl_chan(dchan);
+
+ switch (cmd) {
case FSLDMA_EXTERNAL_START:
/* make sure the channel supports external start */
@@ -1391,8 +1382,9 @@ static int fsldma_of_probe(struct platform_device *op)
fdev->common.device_prep_dma_sg = fsl_dma_prep_sg;
fdev->common.device_tx_status = fsl_tx_status;
fdev->common.device_issue_pending = fsl_dma_memcpy_issue_pending;
- fdev->common.device_prep_slave_sg = fsl_dma_prep_slave_sg;
+ fdev->common.device_config = fsl_dma_device_config;
fdev->common.device_control = fsl_dma_device_control;
+ fdev->common.device_terminate_all = fsl_dma_device_terminate_all;
fdev->common.dev = &op->dev;
dma_set_mask(&(op->dev), DMA_BIT_MASK(36));
--
2.1.1
^ permalink raw reply related
* Re: [PATCH 1/2] mm: Update generic gup implementation to handle hugepage directory
From: Steve Capper @ 2014-10-16 9:25 UTC (permalink / raw)
To: Aneesh Kumar K.V
Cc: Andrea Arcangeli, linux-arch, catalin.marinas, will.deacon,
linux-kernel, linux-mm, linux, akpm, linuxppc-dev
In-Reply-To: <1413390888-4934-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>
On Wed, Oct 15, 2014 at 10:04:47PM +0530, Aneesh Kumar K.V wrote:
> Update generic gup implementation with powerpc specific details.
> On powerpc at pmd level we can have hugepte, normal pmd pointer
> or a pointer to the hugepage directory.
>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Hi,
This patch causes compiler errors on arm and arm64 due to pgd_huge
being undefined. I've attached a fixup below, this fixup will require
that #define pgd_huge(pgd) 0 be added back into:
arch/powerpc/include/asm/page.h
For the second patch in this series.
Another avenue would be to do something like:
#ifndef pgd_huge
#define pgd_huge(pgd) (0)
#endif
Then no changes would be required to arm and arm64 (or other
architectures).
To help with bisectability, could we please have a suitable fix applied
to the two patches in the -mm tree:
http://ozlabs.org/~akpm/mmots/broken-out/mm-update-generic-gup-implementation-to-handle-hugepage-directory.patch
http://ozlabs.org/~akpm/mmots/broken-out/arch-powerpc-switch-to-generic-rcu-get_user_pages_fast.patch
rather than applied afterwards?
With pgd_huge(x) defined, this patch passes my futex test on arm
(Arndale platform) and arm64(Juno).
Cheers,
--
Steve
>From 2fb7b0308f0aca94c50611257ba82d656abb0768 Mon Sep 17 00:00:00 2001
From: Steve Capper <steve.capper@linaro.org>
Date: Thu, 16 Oct 2014 09:09:48 +0100
Subject: [PATCH] Fixup for Update generic gup implementation
The patch:
mm: Update generic gup implementation to handle hugepage directory
will not compile for arm or arm64 due to pgd_huge being undefined.
Signed-off-by: Steve Capper <steve.capper@linaro.org>
---
arch/arm/include/asm/pgtable.h | 2 ++
arch/arm64/include/asm/pgtable.h | 2 ++
include/linux/hugetlb.h | 1 -
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index 90aa4583..46f81fb 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -181,6 +181,8 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
/* to find an entry in a kernel page-table-directory */
#define pgd_offset_k(addr) pgd_offset(&init_mm, addr)
+#define pgd_huge(pgd) (0)
+
#define pmd_none(pmd) (!pmd_val(pmd))
#define pmd_present(pmd) (pmd_val(pmd))
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 464c5ce..d4462ca 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -462,6 +462,8 @@ static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
extern pgd_t idmap_pg_dir[PTRS_PER_PGD];
+#define pgd_huge(pgd) (0)
+
/*
* Encode and decode a swap entry:
* bits 0-1: present (must be zero)
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 65e12a2..6e6d338 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -138,7 +138,6 @@ static inline void hugetlb_show_meminfo(void)
#define prepare_hugepage_range(file, addr, len) (-EINVAL)
#define pmd_huge(x) 0
#define pud_huge(x) 0
-#define pgd_huge(x) 0
#define is_hugepage_only_range(mm, addr, len) 0
#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; })
#define hugetlb_fault(mm, vma, addr, flags) ({ BUG(); 0; })
--
1.9.3
^ permalink raw reply related
* Re: [PATCHv9 2/5] ppc/cell: trivial: replace get_unused_fd() by get_unused_fd_flags(0)
From: Yann Droneaud @ 2014-10-16 9:10 UTC (permalink / raw)
To: Michael Ellerman
Cc: cbe-oss-dev, Yann Droneaud, Jiri Kosina, Arnd Bergmann,
linux-kernel, Paul Mackerras, Jeremy Kerr, linux-fsdevel,
Andrew Morton, linuxppc-dev, Al Viro
In-Reply-To: <1413251832.21120.4.camel@concordia>
Hi,
Le mardi 14 octobre 2014 à 12:57 +1100, Michael Ellerman a écrit :
> On Mon, 2014-10-13 at 21:30 +0200, Yann Droneaud wrote:
> > This patch replaces calls to get_unused_fd() with equivalent call to
> > get_unused_fd_flags(0) to preserve current behavor for existing code.
> >
> > In a further patch, get_unused_fd() will be removed so that new code
> > start using get_unused_fd_flags(), with the hope O_CLOEXEC could be
> > used, either by default or choosen by userspace.
> >
> > Link: http://lkml.kernel.org/r/cover.1413223900.git.ydroneaud@opteya.com
> > Cc: Al Viro <viro@zeniv.linux.org.uk>
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > Cc: trivial@kernel.org
> > Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
>
> This is fine by me, do you want an ack, or do you want us to take it via the
> powerpc tree?
>
The patch was added in -mm by Andrew, so I guess the patch will be
merged sooner or later.
Anyway, you could investigate to check if O_CLOEXEC could be used
instead of 0 in call to get_unused_fd_flags().
> If the former:
>
> Acked-by: Michael Ellerman <mpe@ellerman.id.au>
>
Thanks a lot.
Regards.
--
Yann Droneaud
OPTEYA
^ permalink raw reply
* [PATCH 04/11] dmaengine: fsldma: Remove chancnt affectations
From: Maxime Ripard @ 2014-10-16 9:00 UTC (permalink / raw)
To: dmaengine, Vinod Koul
Cc: linux-kernel, Zhang Wei, Maxime Ripard, linuxppc-dev,
Dan Williams, linux-arm-kernel
In-Reply-To: <1413450063-23829-1-git-send-email-maxime.ripard@free-electrons.com>
chanctnt is already filled by dma_async_device_register, which uses the channel
list to know how much channels there is.
Since it's already filled, we can safely remove it from the drivers' probe
function.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
drivers/dma/fsldma.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index d5d6885ab341..75ae6405a5ee 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -1332,7 +1332,6 @@ static int fsl_dma_chan_probe(struct fsldma_device *fdev,
/* Add the channel to DMA device channel list */
list_add_tail(&chan->common.device_node, &fdev->common.channels);
- fdev->common.chancnt++;
dev_info(fdev->dev, "#%d (%s), irq %d\n", chan->id, compatible,
chan->irq != NO_IRQ ? chan->irq : fdev->irq);
--
2.1.1
^ permalink raw reply related
* Re: [PATCH V7 00/17] Enable SRIOV on POWER8
From: Wei Yang @ 2014-10-16 8:41 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: linux-pci@vger.kernel.org, Wei Yang, Benjamin Herrenschmidt,
linuxppc-dev, Gavin Shan
In-Reply-To: <CAErSpo4g1gtizAsVpxXGWRMDDaNLkjajqdj3xUdckiTf6f3g4Q@mail.gmail.com>
On Wed, Oct 15, 2014 at 07:52:16AM -0600, Bjorn Helgaas wrote:
>On Wed, Oct 15, 2014 at 3:00 AM, Wei Yang <weiyang@linux.vnet.ibm.com> wrote:
>> On Thu, Oct 02, 2014 at 09:59:43AM -0600, Bjorn Helgaas wrote:
>...
>>>I haven't seen any more on this series, and I'm assuming you'll post a
>>>rebased series (maybe you're waiting for v3.18-rc1?). I'm just checking to
>>>make sure you're not waiting for something from me...
>>>
>>
>> Hi, Bjorn
>>
>> Haven't seen you for a long time :-) I am just back from vocation and the mail
>> box doesn't work well for previous two days.
>>
>> Yep, I am rebasing the code on top of v3.17, is this fine for you?
>
>When I apply your patches, they will be on a branch based on
>v3.18-rc1, so the easiest thing for me would be if you generate them
>from that base. Here's why:
>
> - Linus released v3.17 on Oct 5, 2014
> - Merge window for v3.18 opened when v3.17 released
> - All changes intended for v3.18 will be merged during window
>(theoretically, at least)
> - Merge window closes when Linus releases v3.18-rc1 (probably Oct 19 or 26)
>
>Your changes will miss the v3.18 merge window, so the next chance to
>merge them will be during the v3.19 merge window that opens when v3.18
>releases. v3.18-rc1 is a close approximation of what v3.18 will
>eventually be, so rebasing to v3.18-rc1 will minimize merge conflicts
>when we eventually merge your changes on top of v3.18.
>
>v3.18-rc1 isn't out yet, but if you rebase to the current head of
>Linus' tree, that should be fairly close. The PCI changes are already
>in (80213c03c415), and at least some of the powerpc changes are in
>(fd9879b9bb32).
>
Thanks for your explanation. I will do some rebase and test on v3.17. Then
rebase it on v3.18-rc1 when it is released.
And finally give you the one on v3.18-rc1.
>Bjorn
--
Richard Yang
Help you, Help me
^ permalink raw reply
* [RFC 11/11] powerpc: kvm: Kconfig add an option for enabling secondary hwthread
From: kernelfans @ 2014-10-16 19:30 UTC (permalink / raw)
To: linuxppc-dev, kvm-ppc; +Cc: Paul Mackerras, Alexander Graf
In-Reply-To: <1413487800-7162-1-git-send-email-kernelfans@gmail.com>
Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
arch/powerpc/kvm/Kconfig | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/powerpc/kvm/Kconfig b/arch/powerpc/kvm/Kconfig
index 602eb51..de38566 100644
--- a/arch/powerpc/kvm/Kconfig
+++ b/arch/powerpc/kvm/Kconfig
@@ -93,6 +93,10 @@ config KVM_BOOK3S_64_HV
If unsure, say N.
+config KVMPPC_ENABLE_SECONDARY
+ tristate "KVM support for running on secondary hwthread in host"
+ depends on KVM_BOOK3S_64_HV
+
config KVM_BOOK3S_64_PR
tristate "KVM support without using hypervisor mode in host"
depends on KVM_BOOK3S_64
--
1.8.3.1
^ permalink raw reply related
* [RFC 10/11] powerpc: kvm: on_primary_thread() force the secondary threads into NAP mode
From: kernelfans @ 2014-10-16 19:29 UTC (permalink / raw)
To: linuxppc-dev, kvm-ppc; +Cc: Paul Mackerras, Alexander Graf
In-Reply-To: <1413487800-7162-1-git-send-email-kernelfans@gmail.com>
The primary hwthread ceases the scheduler of secondary hwthread by
bringing them into NAP. Then, the secondary is ready for guest.
Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
arch/powerpc/kvm/book3s_hv.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 4348abd..7896c31 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -1593,15 +1593,22 @@ static int on_primary_thread(void)
{
int cpu = smp_processor_id();
int thr;
+ struct cpumask msk;
/* Are we on a primary subcore? */
if (cpu_thread_in_subcore(cpu))
return 0;
thr = 0;
+#ifdef KVMPPC_ENABLE_SECONDARY
+ while (++thr < threads_per_subcore)
+ cpumask_set_cpu(thr, &msk);
+ stop_cpus_async(&msk, kvmppc_secondary_stopper, NULL);
+#else
while (++thr < threads_per_subcore)
if (cpu_online(cpu + thr))
return 0;
+#endif
/* Grab all hw threads so they can't go into the kernel */
for (thr = 1; thr < threads_per_subcore; ++thr) {
--
1.8.3.1
^ permalink raw reply related
* [RFC 09/11] powerpc: kvm: handle time base on secondary hwthread
From: kernelfans @ 2014-10-16 19:29 UTC (permalink / raw)
To: linuxppc-dev, kvm-ppc; +Cc: Paul Mackerras, Alexander Graf
In-Reply-To: <1413487800-7162-1-git-send-email-kernelfans@gmail.com>
(This is a place holder patch.)
We need to store the time base for host on secondary hwthread.
Later when switching back, we need to reprogram it with elapse
time.
Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
arch/powerpc/kvm/book3s_hv_rmhandlers.S | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index 89ea16c..a817ba6 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -371,6 +371,8 @@ _GLOBAL_TOC(kvmppc_secondary_stopper_enter)
/* fixme: store other register such as msr */
+ /* fixme: store the tb, and set it as MAX, so we cease the tick on secondary */
+
/* prevent us to enter kernel */
li r0, 1
stb r0, HSTATE_HWTHREAD_REQ(r13)
@@ -382,6 +384,10 @@ _GLOBAL_TOC(kvmppc_secondary_stopper_enter)
/* enter with vmode */
kvmppc_secondary_stopper_exit:
+ /* fixme: restore the tb, with the orig val plus time elapse
+ * so we can fire the hrtimer as soon as possible
+ */
+
/* fixme, restore the stack which we store on lpaca */
ld r0, 112+PPC_LR_STKOFF(r1)
--
1.8.3.1
^ permalink raw reply related
* [RFC 08/11] powerpc: kvm: add a flag in vcore to sync primary with secondry hwthread
From: kernelfans @ 2014-10-16 19:29 UTC (permalink / raw)
To: linuxppc-dev, kvm-ppc; +Cc: Paul Mackerras, Alexander Graf
In-Reply-To: <1413487800-7162-1-git-send-email-kernelfans@gmail.com>
The secondary thread can only jump back to host until primary has set
up the env. Add host_ready field in kvm_vcore to sync this action.
Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/kvm_host.h | 3 +++
arch/powerpc/kernel/asm-offsets.c | 3 +++
arch/powerpc/kvm/book3s_hv_rmhandlers.S | 11 ++++++++++-
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index 9a3355e..1310e03 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -305,6 +305,9 @@ struct kvmppc_vcore {
u32 arch_compat;
ulong pcr;
ulong dpdes; /* doorbell state (POWER8) */
+#ifdef CONFIG_KVMPPC_ENABLE_SECONDARY
+ u8 host_ready;
+#endif
void *mpp_buffer; /* Micro Partition Prefetch buffer */
bool mpp_buffer_is_valid;
};
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 0faa8fe..9c04ac2 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -562,6 +562,9 @@ int main(void)
DEFINE(VCORE_LPCR, offsetof(struct kvmppc_vcore, lpcr));
DEFINE(VCORE_PCR, offsetof(struct kvmppc_vcore, pcr));
DEFINE(VCORE_DPDES, offsetof(struct kvmppc_vcore, dpdes));
+#ifdef CONFIG_KVMPPC_ENABLE_SECONDARY
+ DEFINE(VCORE_HOST_READY, offsetof(struct kvmppc_vcore, host_ready));
+#endif
DEFINE(VCPU_SLB_E, offsetof(struct kvmppc_slb, orige));
DEFINE(VCPU_SLB_V, offsetof(struct kvmppc_slb, origv));
DEFINE(VCPU_SLB_SIZE, sizeof(struct kvmppc_slb));
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index 254038b..89ea16c 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -351,7 +351,11 @@ kvm_do_nap:
kvm_secondary_exit_trampoline:
/* all register is free to use, later kvmppc_secondary_stopper_exit set up them*/
- //loop-wait for the primary to signal that host env is ready
+ /* wait until the primary to set up host env */
+ ld r5, HSTATE_KVM_VCORE(r13)
+ ld r0, VCORE_HOST_READY(r5)
+ cmp r0, //primary is ready?
+ bne kvm_secondary_exit_trampoline
LOAD_REG_ADDR(r5, kvmppc_secondary_stopper_exit)
/* fixme, load msr from lpaca stack */
@@ -1821,6 +1825,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
li r0, KVM_GUEST_MODE_NONE
stb r0, HSTATE_IN_GUEST(r13)
+#ifdef PPCKVM_ENABLE_SECONDARY
+ /* signal the secondary that host env is ready */
+ li r0, 1
+ stb r0, VCORE_HOST_READY(r5)
+#endif
ld r0, 112+PPC_LR_STKOFF(r1)
addi r1, r1, 112
mtlr r0
--
1.8.3.1
^ permalink raw reply related
* [RFC 07/11] powerpc: kvm: the stopper func to cease secondary hwthread
From: kernelfans @ 2014-10-16 19:29 UTC (permalink / raw)
To: linuxppc-dev, kvm-ppc; +Cc: Paul Mackerras, Alexander Graf
In-Reply-To: <1413487800-7162-1-git-send-email-kernelfans@gmail.com>
To enter guest, primary hwtherad schedules the stopper func on
secondary threads and force them into NAP mode.
When exit to host,secondary threads hardcode to restore the stack,
then switch back to the stopper func, i.e host.
Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
arch/powerpc/kvm/book3s_hv.c | 15 +++++++++++++++
arch/powerpc/kvm/book3s_hv_rmhandlers.S | 34 +++++++++++++++++++++++++++++++++
2 files changed, 49 insertions(+)
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index ba258c8..4348abd 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -1486,6 +1486,21 @@ static void kvmppc_remove_runnable(struct kvmppc_vcore *vc,
list_del(&vcpu->arch.run_list);
}
+#ifdef KVMPPC_ENABLE_SECONDARY
+
+extern void kvmppc_secondary_stopper_enter();
+
+static int kvmppc_secondary_stopper(void *data)
+{
+ int cpu =smp_processor_id();
+ struct paca_struct *lpaca = get_paca();
+ BUG_ON(!(cpu%thread_per_core));
+
+ kvmppc_secondary_stopper_enter();
+}
+
+#endif
+
static int kvmppc_grab_hwthread(int cpu)
{
struct paca_struct *tpaca;
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index d5594b0..254038b 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -349,7 +349,41 @@ kvm_do_nap:
#ifdef PPCKVM_ENABLE_SECONDARY
kvm_secondary_exit_trampoline:
+
+ /* all register is free to use, later kvmppc_secondary_stopper_exit set up them*/
+ //loop-wait for the primary to signal that host env is ready
+
+ LOAD_REG_ADDR(r5, kvmppc_secondary_stopper_exit)
+ /* fixme, load msr from lpaca stack */
+ li r6, MSR_IR | MSR_DR
+ mtsrr0 r5
+ mtsrr1 r6
+ RFI
+
+_GLOBAL_TOC(kvmppc_secondary_stopper_enter)
+ mflr r0
+ std r0, PPC_LR_STKOFF(r1)
+ stdu r1, -112(r1)
+
+ /* fixme: store other register such as msr */
+
+ /* prevent us to enter kernel */
+ li r0, 1
+ stb r0, HSTATE_HWTHREAD_REQ(r13)
+ /* tell the primary that we are ready */
+ li r0,KVM_HWTHREAD_IN_KERNEL
+ stb r0,HSTATE_HWTHREAD_STATE(r13)
+ nap
b .
+
+/* enter with vmode */
+kvmppc_secondary_stopper_exit:
+ /* fixme, restore the stack which we store on lpaca */
+
+ ld r0, 112+PPC_LR_STKOFF(r1)
+ addi r1, r1, 112
+ mtlr r0
+ blr
#endif
/******************************************************************************
--
1.8.3.1
^ permalink raw reply related
* [RFC 06/11] powerpc: kvm: introduce online in paca to indicate whether cpu is needed by host
From: kernelfans @ 2014-10-16 19:29 UTC (permalink / raw)
To: linuxppc-dev, kvm-ppc; +Cc: Paul Mackerras, Alexander Graf
In-Reply-To: <1413487800-7162-1-git-send-email-kernelfans@gmail.com>
Nowadays, powerKVM runs with secondary hwthread offline. Although
we can make all secondary hwthread online later, we still preserve
this behavior for dedicated KVM env. Achieve this by setting
paca->online as false.
Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/paca.h | 3 +++
arch/powerpc/kernel/asm-offsets.c | 3 +++
arch/powerpc/kernel/smp.c | 3 +++
arch/powerpc/kvm/book3s_hv_rmhandlers.S | 12 ++++++++++++
4 files changed, 21 insertions(+)
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index a5139ea..67c2500 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -84,6 +84,9 @@ struct paca_struct {
u8 cpu_start; /* At startup, processor spins until */
/* this becomes non-zero. */
u8 kexec_state; /* set when kexec down has irqs off */
+#ifdef CONFIG_KVMPPC_ENABLE_SECONDARY
+ u8 online;
+#endif
#ifdef CONFIG_PPC_STD_MMU_64
struct slb_shadow *slb_shadow_ptr;
struct dtl_entry *dispatch_log;
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 9d7dede..0faa8fe 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -182,6 +182,9 @@ int main(void)
DEFINE(PACATOC, offsetof(struct paca_struct, kernel_toc));
DEFINE(PACAKBASE, offsetof(struct paca_struct, kernelbase));
DEFINE(PACAKMSR, offsetof(struct paca_struct, kernel_msr));
+#ifdef CONFIG_KVMPPC_ENABLE_SECONDARY
+ DEFINE(PACAONLINE, offsetof(struct paca_struct, online));
+#endif
DEFINE(PACASOFTIRQEN, offsetof(struct paca_struct, soft_enabled));
DEFINE(PACAIRQHAPPENED, offsetof(struct paca_struct, irq_happened));
DEFINE(PACACONTEXTID, offsetof(struct paca_struct, context.id));
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index a0738af..4c3843e 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -736,6 +736,9 @@ void start_secondary(void *unused)
cpu_startup_entry(CPUHP_ONLINE);
+#ifdef CONFIG_KVMPPC_ENABLE_SECONDARY
+ get_paca()->online = true;
+#endif
BUG();
}
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index f0c4db7..d5594b0 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -322,6 +322,13 @@ kvm_no_guest:
li r0, KVM_HWTHREAD_IN_NAP
stb r0, HSTATE_HWTHREAD_STATE(r13)
kvm_do_nap:
+#ifdef PPCKVM_ENABLE_SECONDARY
+ /* check the cpu is needed by host or not */
+ ld r2, PACAONLINE(r13)
+ ld r3, 0
+ cmp r2, r3
+ bne kvm_secondary_exit_trampoline
+#endif
/* Clear the runlatch bit before napping */
mfspr r2, SPRN_CTRLF
clrrdi r2, r2, 1
@@ -340,6 +347,11 @@ kvm_do_nap:
nap
b .
+#ifdef PPCKVM_ENABLE_SECONDARY
+kvm_secondary_exit_trampoline:
+ b .
+#endif
+
/******************************************************************************
* *
* Entry code *
--
1.8.3.1
^ permalink raw reply related
* [RFC 05/11] sched: introduce stop_cpus_async() to schedule special tsk on cpu
From: kernelfans @ 2014-10-16 19:29 UTC (permalink / raw)
To: linuxppc-dev, kvm-ppc; +Cc: Paul Mackerras, Alexander Graf
In-Reply-To: <1413487800-7162-1-git-send-email-kernelfans@gmail.com>
The proto will be:
cpu1 cpuX
stop_cpus_async()
bring cpuX to a special state
signal flag and trapped
check for flag
The func help powerpc to reuse the scheme of cpu_stopper_task
to force the secondary hwthread goto NAP state, in which state,
cpu will not run any longer until the master cpu tells them to
go.
Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
include/linux/stop_machine.h | 2 ++
kernel/stop_machine.c | 25 ++++++++++++++++++++-----
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h
index d2abbdb..871c1bf 100644
--- a/include/linux/stop_machine.h
+++ b/include/linux/stop_machine.h
@@ -32,6 +32,8 @@ int stop_two_cpus(unsigned int cpu1, unsigned int cpu2, cpu_stop_fn_t fn, void *
void stop_one_cpu_nowait(unsigned int cpu, cpu_stop_fn_t fn, void *arg,
struct cpu_stop_work *work_buf);
int stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg);
+int stop_cpus_async(const struct cpumask *cpumask, cpu_stop_fn_t fn,
+ void *arg);
int try_stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg);
#else /* CONFIG_SMP */
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
index 695f0c6..d26fd6a 100644
--- a/kernel/stop_machine.c
+++ b/kernel/stop_machine.c
@@ -354,13 +354,15 @@ static void queue_stop_cpus_work(const struct cpumask *cpumask,
}
static int __stop_cpus(const struct cpumask *cpumask,
- cpu_stop_fn_t fn, void *arg)
+ cpu_stop_fn_t fn, void *arg, bool sync)
{
struct cpu_stop_done done;
- cpu_stop_init_done(&done, cpumask_weight(cpumask));
+ if (sync)
+ cpu_stop_init_done(&done, cpumask_weight(cpumask));
queue_stop_cpus_work(cpumask, fn, arg, &done);
- wait_for_completion(&done.completion);
+ if (sync)
+ wait_for_completion(&done.completion);
return done.executed ? done.ret : -ENOENT;
}
@@ -398,7 +400,20 @@ int stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg)
/* static works are used, process one request at a time */
mutex_lock(&stop_cpus_mutex);
- ret = __stop_cpus(cpumask, fn, arg);
+ ret = __stop_cpus(cpumask, fn, arg, true);
+ mutex_unlock(&stop_cpus_mutex);
+ return ret;
+}
+
+/* similar to stop_cpus(), but not wait for the ack. */
+int stop_cpus_async(const struct cpumask *cpumask, cpu_stop_fn_t fn,
+ void *arg)
+{
+ int ret;
+
+ /* static works are used, process one request at a time */
+ mutex_lock(&stop_cpus_mutex);
+ ret = __stop_cpus(cpumask, fn, arg, false);
mutex_unlock(&stop_cpus_mutex);
return ret;
}
@@ -428,7 +443,7 @@ int try_stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg)
/* static works are used, process one request at a time */
if (!mutex_trylock(&stop_cpus_mutex))
return -EAGAIN;
- ret = __stop_cpus(cpumask, fn, arg);
+ ret = __stop_cpus(cpumask, fn, arg, true);
mutex_unlock(&stop_cpus_mutex);
return ret;
}
--
1.8.3.1
^ permalink raw reply related
* [RFC 04/11] powerpc: kvm: introduce a kthread on primary thread to anti tickless
From: kernelfans @ 2014-10-16 19:29 UTC (permalink / raw)
To: linuxppc-dev, kvm-ppc; +Cc: Paul Mackerras, Alexander Graf
In-Reply-To: <1413487800-7162-1-git-send-email-kernelfans@gmail.com>
(This patch is a place holder.)
If there is only one vcpu thread is ready(the other vcpu thread can
wait for it to execute), the primary thread can enter tickless mode,
which causes the primary keeps running, so the secondary has no
opportunity to exit to host, even they have other tsk on them.
Introduce a kthread (anti_tickless) on primary, so when there is only
one vcpu thread on primary, the secondary can resort to anti_tickless
to keep the primary out of tickless mode.
(I thought that anti_tickless thread can goto NAP, so we can let the
secondary run).
Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
arch/powerpc/kernel/sysfs.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index a2595dd..f0b110e 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -575,9 +575,11 @@ static ssize_t __used store_kvm_enable(struct device *dev,
if (!test_bit(core, &kvm_on_core))
for (thr = 1; thr< threads_per_core; thr++)
if (cpu_online(thr * threads_per_core + thr))
- cpumask_set_cpu(thr * threads_per_core + thr, &stop_cpus);
+ cpumask_set_cpu(core * threads_per_core + thr, &stop_cpus);
stop_machine(xics_migrate_irqs_away_secondary, NULL, &stop_cpus);
+ /* fixme, create a kthread on primary hwthread to handle tickless mode */
+ //kthread_create_on_cpu(prevent_tickless, NULL, core * threads_per_core, "ppckvm_prevent_tickless");
set_bit(core, &kvm_on_core);
return count;
}
--
1.8.3.1
^ permalink raw reply related
* [RFC 03/11] powerpc: kvm: add interface to control kvm function on a core
From: kernelfans @ 2014-10-16 19:29 UTC (permalink / raw)
To: linuxppc-dev, kvm-ppc; +Cc: Paul Mackerras, Alexander Graf
In-Reply-To: <1413487800-7162-1-git-send-email-kernelfans@gmail.com>
When kvm is enabled on a core, we migrate all external irq to primary
thread. Since currently, the kvmirq logic is handled by the primary
hwthread.
Todo: this patch lacks re-enable of irqbalance when kvm is disable on
the core
Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
arch/powerpc/kernel/sysfs.c | 39 ++++++++++++++++++++++++++++++++++
arch/powerpc/sysdev/xics/xics-common.c | 12 +++++++++++
2 files changed, 51 insertions(+)
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 67fd2fd..a2595dd 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -552,6 +552,45 @@ static void sysfs_create_dscr_default(void)
if (cpu_has_feature(CPU_FTR_DSCR))
err = device_create_file(cpu_subsys.dev_root, &dev_attr_dscr_default);
}
+
+#ifdef CONFIG_KVMPPC_ENABLE_SECONDARY
+#define NR_CORES (CONFIG_NR_CPUS/threads_per_core)
+static DECLARE_BITMAP(kvm_on_core, NR_CORES) __read_mostly
+
+static ssize_t show_kvm_enable(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+}
+
+static ssize_t __used store_kvm_enable(struct device *dev,
+ struct device_attribute *attr, const char *buf,
+ size_t count)
+{
+ struct cpumask stop_cpus;
+ unsigned long core, thr;
+
+ sscanf(buf, "%lx", &core);
+ if (core > NR_CORES)
+ return -1;
+ if (!test_bit(core, &kvm_on_core))
+ for (thr = 1; thr< threads_per_core; thr++)
+ if (cpu_online(thr * threads_per_core + thr))
+ cpumask_set_cpu(thr * threads_per_core + thr, &stop_cpus);
+
+ stop_machine(xics_migrate_irqs_away_secondary, NULL, &stop_cpus);
+ set_bit(core, &kvm_on_core);
+ return count;
+}
+
+static DEVICE_ATTR(kvm_enable, 0600,
+ show_kvm_enable, store_kvm_enable);
+
+static void sysfs_create_kvm_enable(void)
+{
+ device_create_file(cpu_subsys.dev_root, &dev_attr_kvm_enable);
+}
+#endif
+
#endif /* CONFIG_PPC64 */
#ifdef HAS_PPC_PMC_PA6T
diff --git a/arch/powerpc/sysdev/xics/xics-common.c b/arch/powerpc/sysdev/xics/xics-common.c
index fe0cca4..68b33d8 100644
--- a/arch/powerpc/sysdev/xics/xics-common.c
+++ b/arch/powerpc/sysdev/xics/xics-common.c
@@ -258,6 +258,18 @@ unlock:
raw_spin_unlock_irqrestore(&desc->lock, flags);
}
}
+
+int xics_migrate_irqs_away_secondary(void *data)
+{
+ int cpu = smp_processor_id();
+ if(cpu%thread_per_core != 0) {
+ WARN(condition, format...);
+ return 0;
+ }
+ /* In fact, if we can migrate the primary, it will be more fine */
+ xics_migrate_irqs_away();
+ return 0;
+}
#endif /* CONFIG_HOTPLUG_CPU */
#ifdef CONFIG_SMP
--
1.8.3.1
^ permalink raw reply related
* [RFC 02/11] powerpc: kvm: ensure vcpu-thread run only on primary hwthread
From: kernelfans @ 2014-10-16 19:29 UTC (permalink / raw)
To: linuxppc-dev, kvm-ppc; +Cc: Paul Mackerras, Alexander Graf
In-Reply-To: <1413487800-7162-1-git-send-email-kernelfans@gmail.com>
When vcpu thread runs at the first time, it will ensure to stick
to the primary thread.
Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/kvm_host.h | 3 +++
arch/powerpc/kvm/book3s_hv.c | 17 +++++++++++++++++
2 files changed, 20 insertions(+)
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index 98d9dd5..9a3355e 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -666,6 +666,9 @@ struct kvm_vcpu_arch {
spinlock_t tbacct_lock;
u64 busy_stolen;
u64 busy_preempt;
+#ifdef CONFIG_KVMPPC_ENABLE_SECONDARY
+ bool cpu_selected;
+#endif
#endif
};
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 27cced9..ba258c8 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -1909,6 +1909,23 @@ static int kvmppc_vcpu_run_hv(struct kvm_run *run, struct kvm_vcpu *vcpu)
{
int r;
int srcu_idx;
+#ifdef CONFIG_KVMPPC_ENABLE_SECONDARY
+ int cpu = smp_processor_id();
+ int target_cpu;
+ unsigned int cpu;
+ struct task_struct *p = current;
+
+ if (unlikely(!vcpu->arch.cpu_selected)) {
+ vcpu->arch.cpu_selected = true;
+ for (cpu = 0; cpu < NR_CPUS; cpu+=threads_per_core) {
+ cpumask_set_cpu(cpu, &p->sys_allowed);
+ }
+ if (cpu%threads_per_core != 0) {
+ target_cpu = cpu/threads_per_core*threads_per_core;
+ migrate_task_to(current, target_cpu);
+ }
+ }
+#endif
if (!vcpu->arch.sane) {
run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
--
1.8.3.1
^ permalink raw reply related
* [RFC 01/11] sched: introduce sys_cpumask in tsk to adapt asymmetric system
From: kernelfans @ 2014-10-16 19:29 UTC (permalink / raw)
To: linuxppc-dev, kvm-ppc; +Cc: Paul Mackerras, Alexander Graf
In-Reply-To: <1413487800-7162-1-git-send-email-kernelfans@gmail.com>
Some system such as powerpc, some tsk (vcpu thread) can only run on
the dedicated cpu. Since we adapt some asymmetric method to monitor the
whole physical cpu. (powerKVM only allows the primary hwthread to
set up runtime env for the secondary when entering guest).
Nowadays, powerKVM run with all the secondary hwthread offline to ensure
the vcpu threads only run on the primary thread. But we plan to keep all
cpus online when running powerKVM to give more power when switching back
to host, so introduce sys_allowed cpumask to reflect the cpuset which
the vcpu thread can run on.
Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
include/linux/init_task.h | 1 +
include/linux/sched.h | 6 ++++++
kernel/sched/core.c | 10 ++++++++--
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 2bb4c4f3..c56f69e 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -172,6 +172,7 @@ extern struct task_group root_task_group;
.normal_prio = MAX_PRIO-20, \
.policy = SCHED_NORMAL, \
.cpus_allowed = CPU_MASK_ALL, \
+ .sys_allowed = CPU_MASK_ALL, \
.nr_cpus_allowed= NR_CPUS, \
.mm = NULL, \
.active_mm = &init_mm, \
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 5c2c885..ce429f3 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1260,7 +1260,10 @@ struct task_struct {
unsigned int policy;
int nr_cpus_allowed;
+ /* Anded user and sys_allowed */
cpumask_t cpus_allowed;
+ /* due to the feature of asymmetric, some tsk can only run on such cpu */
+ cpumask_t sys_allowed;
#ifdef CONFIG_PREEMPT_RCU
int rcu_read_lock_nesting;
@@ -2030,6 +2033,9 @@ static inline void tsk_restore_flags(struct task_struct *task,
}
#ifdef CONFIG_SMP
+extern void set_cpus_sys_allowed(struct task_struct *p,
+ const struct cpumask *new_mask);
+
extern void do_set_cpus_allowed(struct task_struct *p,
const struct cpumask *new_mask);
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index ec1a286..2cd1ae3 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4596,13 +4596,19 @@ void init_idle(struct task_struct *idle, int cpu)
}
#ifdef CONFIG_SMP
+void set_cpus_sys_allowed(struct task_struct *p,
+ const struct cpumask *new_mask)
+{
+ cpumask_copy(&p->sys_allowed, new_mask);
+}
+
void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask)
{
if (p->sched_class && p->sched_class->set_cpus_allowed)
p->sched_class->set_cpus_allowed(p, new_mask);
- cpumask_copy(&p->cpus_allowed, new_mask);
- p->nr_cpus_allowed = cpumask_weight(new_mask);
+ cpumask_and(&p->cpus_allowed, &p->sys_allowed, new_mask);
+ p->nr_cpus_allowed = cpumask_weight(&p->cpus_allowed);
}
/*
--
1.8.3.1
^ permalink raw reply related
* [RFC 00/11]: powerKVM, release the compute power of secondary hwthread on host
From: kernelfans @ 2014-10-16 19:29 UTC (permalink / raw)
To: linuxppc-dev, kvm-ppc; +Cc: Paul Mackerras, Alexander Graf
Nowadays, when running powerKVM(book3s, hv mode), we should make the secondary hwthread
offline. Which means that if we run misc tsks other than dedicated KVM (e.g mix java and KVM),
we will lose the compute power of the secondary hwthread on host env.
This series aim to make the powerpc adaptive to the misc tsks on host.
( This series is just a sketch, with some broken patch. Sorry to bring up it in a hurry,
I am afraid that I am on the wrong direction too far. So I hope I can get some advice and feedback
in advance. I will go on the work on the "place holder" patch if my idea is reasonable.
Please consider the code as the explaining of my idea.
)
The internal:
-1.To enter guest, the primary hwthread schedule stopper func on the secondary to bring them into NAP mode.
The proto will be:
cpu1 cpuX
stop_cpus_async()
bring cpuX to a special state
signal flag and trapped
check for flag
set up guest env and ipi cpuX
-2.When exit to host, the secondary hardcode to jmp back to the stopper func, i.e back to host.
Drawbacks that I can think so far:
-1. increase the sched interval on secondary but the schduler do NOT know it.(can it cause problem?)
-2. lose some presice of hrtime on secondary hwthread for host.(To avoid the primary
has too small time slice, we need to impose a threshold,so we may lose the presice)
Any suggestion? Thanks!
Liu Ping Fan (11):
sched: introduce sys_cpumask in tsk to adapt asymmetric system
powerpc: kvm: ensure vcpu-thread run only on primary hwthread
powerpc: kvm: add interface to control kvm function on a core
powerpc: kvm: introduce a kthread on primary thread to anti tickless
sched: introduce stop_cpus_async() to schedule special tsk on cpu
powerpc: kvm: introduce online in paca to indicate whether cpu is
needed by host
powerpc: kvm: the stopper func to cease secondary hwthread
powerpc: kvm: add a flag in vcore to sync primary with secondry
hwthread
powerpc: kvm: handle time base on secondary hwthread
powerpc: kvm: on_primary_thread() force the secondary threads into NAP
mode
powerpc: kvm: Kconfig add an option for enabling secondary hwthread
arch/powerpc/include/asm/kvm_host.h | 6 ++++
arch/powerpc/include/asm/paca.h | 3 ++
arch/powerpc/kernel/asm-offsets.c | 6 ++++
arch/powerpc/kernel/smp.c | 3 ++
arch/powerpc/kernel/sysfs.c | 41 ++++++++++++++++++++++
arch/powerpc/kvm/Kconfig | 4 +++
arch/powerpc/kvm/book3s_hv.c | 39 +++++++++++++++++++++
arch/powerpc/kvm/book3s_hv_rmhandlers.S | 61 +++++++++++++++++++++++++++++++++
arch/powerpc/sysdev/xics/xics-common.c | 12 +++++++
include/linux/init_task.h | 1 +
include/linux/sched.h | 6 ++++
include/linux/stop_machine.h | 2 ++
kernel/sched/core.c | 10 ++++--
kernel/stop_machine.c | 25 +++++++++++---
14 files changed, 212 insertions(+), 7 deletions(-)
--
1.8.3.1
^ permalink raw reply
* [PATCH v2] powerpc: Only do dynamic DMA zone limits on platforms that need it
From: Michael Ellerman @ 2014-10-16 6:47 UTC (permalink / raw)
To: linuxppc-dev; +Cc: scottwood, Anton Blanchard
Scott's patch 1c98025c6c95 "Dynamic DMA zone limits" changed
dma_direct_alloc_coherent() to start using dev->coherent_dma_mask.
That seems fair enough, but it exposes the fact that some of the drivers
we care about on IBM platforms aren't setting the coherent mask.
The proper fix is to have drivers set the coherent mask and also have
the platform code honor it.
For now, just restrict the dynamic DMA zone limits to the platforms that
need it.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/kernel/dma.c | 8 ++++++++
1 file changed, 8 insertions(+)
v2: Use FSL_SOC.
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
index adac9dc54aee..484b2d4462c1 100644
--- a/arch/powerpc/kernel/dma.c
+++ b/arch/powerpc/kernel/dma.c
@@ -53,9 +53,16 @@ void *dma_direct_alloc_coherent(struct device *dev, size_t size,
#else
struct page *page;
int node = dev_to_node(dev);
+#ifdef CONFIG_FSL_SOC
u64 pfn = get_pfn_limit(dev);
int zone;
+ /*
+ * This code should be OK on other platforms, but we have drivers that
+ * don't set coherent_dma_mask. As a workaround we just ifdef it. This
+ * whole routine needs some serious cleanup.
+ */
+
zone = dma_pfn_limit_to_zone(pfn);
if (zone < 0) {
dev_err(dev, "%s: No suitable zone for pfn %#llx\n",
@@ -73,6 +80,7 @@ void *dma_direct_alloc_coherent(struct device *dev, size_t size,
break;
#endif
};
+#endif /* CONFIG_FSL_SOC */
/* ignore region specifiers */
flag &= ~(__GFP_HIGHMEM);
--
1.9.1
^ permalink raw reply related
* [git pull] Please pull mpe.git for-linus branch (for powerpc)
From: Michael Ellerman @ 2014-10-16 6:13 UTC (permalink / raw)
To: Linus Torvalds
Cc: linus.walleij, Liviu.Dudau, linux-kernel, linuxppc-dev list,
bhelgaas
[-- Attachment #1: Type: text/plain, Size: 1014 bytes --]
Hi Linus,
There was a bit of a misunderstanding between us and the ARM guys in the device
tree PCI code, which is breaking virtio on powerpc. This is the minimal fix
until we can sort it out properly.
cheers
The following changes since commit 0429fbc0bdc297d64188483ba029a23773ae07b0:
Merge branch 'for-3.18-consistent-ops' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu (2014-10-15 07:48:18 +0200)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mpe/linux.git for-linus
for you to fetch changes up to aeba3731b150188685225b510886f1370d8814de:
powerpc/pci: Fix IO space breakage after of_pci_range_to_resource() change (2014-10-16 14:19:07 +1100)
----------------------------------------------------------------
Michael Ellerman (1):
powerpc/pci: Fix IO space breakage after of_pci_range_to_resource() change
arch/powerpc/kernel/pci-common.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [GIT PULL 00/15] perf/core improvements and fixes
From: Ingo Molnar @ 2014-10-16 5:18 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Mike Galbraith, Alexander Yarygin, Peter Zijlstra,
Frederic Weisbecker, Stephane Eranian, Masanari Iida,
Paul Mackerras, Jiri Olsa, Anshuman Khandual, Namhyung Kim,
Andi Kleen, Christian Borntraeger, Cody P Schafer, Jean Pihet,
Sukadev Bhattiprolu, Arun Sharma, Arnaldo Carvalho de Melo,
Yasser Shalabi, Michael Ellerman, Kan Liang, Randy Dunlap,
linux-kernel, Taeung Song, David Ahern, linuxppc-dev
In-Reply-To: <1413406368-26245-1-git-send-email-acme@kernel.org>
* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> Hi Ingo,
>
> Please consider pulling, I guess the changes are minor of affect just some
> non-core feature, so it is you call if you prefer to pull it into perf/urgent instead.
>
> Best Regards,
>
> - Arnaldo
>
> The following changes since commit ec4212d88a77eb6caec10777ddd629b702a5ebbd:
>
> Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent (2014-10-15 11:54:14 +0200)
>
> are available in the git repository at:
>
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo
>
> for you to fetch changes up to 673d659f5c5918b7ddbafebf1f129c9eb82973b4:
>
> perf kvm stat live: Enable events copying (2014-10-15 17:39:03 -0300)
>
> ----------------------------------------------------------------
> perf/core improvements and fixes:
>
> User visible:
>
> * Add a visual cue for toggle zeroing of samples in 'perf top' (Taeung Song)
>
> * Fix for double free in 'perf stat' when using some specific invalid
> command line combo (Yasser Shalabi)
>
> Infrastructure:
>
> * Add option to copy events when queuing for sorting across cpu buffers
> and enable it for 'perf kvm stat live', to avoid having events left
> in the queue pointing to the ring buffer be rewritten in high volume
> sessions. (Alexander Yarygin, improving work done by David Ahern):
>
> * Document sysfs events/ interfaces (Cody P Schafer)
>
> * Add support to new style format of kernel PMU event. (Kan Liang)
>
> * Fix typos in perf/Documentation (Masanari Iida)
>
> * Improve callchains when using libunwind (Namhyung Kim)
>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> Lines starting with '#' will be ignored.
>
> ----------------------------------------------------------------
> Alexander Yarygin (2):
> perf session: Add option to copy events when queueing
> perf kvm stat live: Enable events copying
>
> Cody P Schafer (2):
> perf Documentation: sysfs events/ interfaces
> perf Documentation: Remove Ruplicated docs for powerpc cpu specific events
>
> Kan Liang (4):
> Revert "perf tools: Default to cpu// for events v5"
> perf tools: Parse the pmu event prefix and suffix
> perf tools: Add support to new style format of kernel PMU event
> perf test: Add test case for pmu event new style format
>
> Masanari Iida (1):
> perf Documentation: Fix typos in perf/Documentation
>
> Namhyung Kim (4):
> perf report: Set callchain_param.record_mode for future use
> perf callchain: Create an address space per thread
> perf kvm: Use thread_{,_set}_priv helpers
> perf trace: Use thread_{,_set}_priv helpers
>
> Taeung Song (1):
> perf top: Add a visual cue for toggle zeroing of samples
>
> Yasser Shalabi (1):
> perf evlist: Fix for double free in tools/perf stat
>
> .../testing/sysfs-bus-event_source-devices-events | 611 ++-------------------
> tools/perf/Documentation/perf-diff.txt | 6 +-
> tools/perf/Documentation/perf-kvm.txt | 4 +-
> tools/perf/Documentation/perf-list.txt | 2 +-
> tools/perf/Documentation/perf-record.txt | 2 +-
> tools/perf/Documentation/perf-script-perl.txt | 4 +-
> tools/perf/Documentation/perf-script-python.txt | 6 +-
> tools/perf/Documentation/perf-script.txt | 2 +-
> tools/perf/Documentation/perf-test.txt | 2 +-
> tools/perf/Documentation/perf-trace.txt | 2 +-
> tools/perf/builtin-kvm.c | 7 +-
> tools/perf/builtin-report.c | 7 +
> tools/perf/builtin-trace.c | 16 +-
> tools/perf/tests/dwarf-unwind.c | 3 +
> tools/perf/tests/parse-events.c | 36 ++
> tools/perf/ui/browsers/hists.c | 32 +-
> tools/perf/util/evlist.c | 1 +
> tools/perf/util/include/linux/string.h | 1 -
> tools/perf/util/ordered-events.c | 49 +-
> tools/perf/util/ordered-events.h | 10 +-
> tools/perf/util/parse-events.c | 133 ++++-
> tools/perf/util/parse-events.h | 14 +
> tools/perf/util/parse-events.l | 30 +-
> tools/perf/util/parse-events.y | 40 ++
> tools/perf/util/pmu.c | 10 -
> tools/perf/util/pmu.h | 10 +
> tools/perf/util/session.c | 5 +-
> tools/perf/util/string.c | 24 -
> tools/perf/util/thread.c | 6 +
> tools/perf/util/unwind-libunwind.c | 37 +-
> tools/perf/util/unwind.h | 17 +
> 31 files changed, 460 insertions(+), 669 deletions(-)
Pulled, thanks a lot Arnaldo!
Ingo
^ 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