* Re: [PATCH] powerpc, perf: Configure BHRB filter before enabling PMU interrupts
From: Anshuman Khandual @ 2013-12-13 6:46 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev, mikey
In-Reply-To: <525E166C.5070407@linux.vnet.ibm.com>
On 10/16/2013 10:00 AM, Anshuman Khandual wrote:
> On 10/14/2013 11:49 AM, Michael Ellerman wrote:
>> On Fri, Oct 11, 2013 at 10:02:28AM +0530, Anshuman Khandual wrote:
>>> On 10/11/2013 07:41 AM, Michael Ellerman wrote:
>>>> On Thu, Oct 10, 2013 at 02:20:22PM +0530, Anshuman Khandual wrote:
>>>>
>>>>> Even I think this is not right. Instruction sampling should have been
>>>>> enabled before we enable PMU interrupts. Else there is a small window
>>>>> of time where we could have the PMU enabled with events (which requires
>>>>> sampling) without the sampling itself being enabled in MMCRA.
>>>>
>>>> Yes I agree. That's a separate bug, which we'll need to test on all the book3s
>>>> platforms we have perf support for.
>>>
>>> Okay, I guess any platform which supports sampling will definitely want to have
>>> it enabled before we can set the events to count on PMU. Can you think of any
>>> problem which can arise if we move it before the enabling the PMU back ? Else
>>> we can fix this easily.
>>
>> In theory it should be a trivial change. But hardware can behave in
>> strange ways, it's possible on some old chip we need to do it the
>> current way for some reason.
>>
>> So although I don't think it will be a problem, it could be, so we
>> will need to test it thoroughly.
>
> So which are the HW chips, you would like to test this fix for possible problems ?
>
Michael,
Any updates on this patch ?
^ permalink raw reply
* Re: [PATCH V4 09/10] power8, perf: Change BHRB branch filter configuration
From: Anshuman Khandual @ 2013-12-13 8:20 UTC (permalink / raw)
To: Michael Ellerman
Cc: mikey, ak, linux-kernel, eranian, linuxppc-dev, acme, sukadev,
mingo
In-Reply-To: <20131209062147.51F822C00C5@ozlabs.org>
On 12/09/2013 11:51 AM, Michael Ellerman wrote:
>
> As I said in my comments on version 3 which you ignored:
>
> I think it would be clearer if we actually checked for the possibilities we
> allow and let everything else fall through, eg:
>
> Â Â Â Â Â Â Â Â /* Ignore user/kernel/hv bits */
> Â Â Â Â Â Â Â Â branch_sample_type &= ~PERF_SAMPLE_BRANCH_PLM_ALL;
>
> Â Â Â Â Â Â Â Â if (branch_sample_type == PERF_SAMPLE_BRANCH_ANY)
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â return 0;
>
> Â Â Â Â Â Â Â Â if (branch_sample_type == PERF_SAMPLE_BRANCH_ANY_CALL)
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â return POWER8_MMCRA_IFM1;
> Â
> Â Â Â Â Â Â Â Â if (branch_sample_type == PERF_SAMPLE_BRANCH_COND)
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â return POWER8_MMCRA_IFM3;
> Â Â Â Â Â Â Â Â
> Â Â Â Â Â Â Â Â return -1;
>
Hey Michael,
This patch only adds support for the PERF_SAMPLE_BRANCH_COND filter, if the
over all code flow does not clearly suggest that all combinations of any of
these HW filters are invalid, then we can go with one more patch to clean
that up before or after this patch but not here in this patch. Finally the
code section here will look something like this. Does it sound good ?
static u64 power8_bhrb_filter_map(u64 branch_sample_type)
{
u64 pmu_bhrb_filter = 0;
/* BHRB and regular PMU events share the same privilege state
* filter configuration. BHRB is always recorded along with a
* regular PMU event. As the privilege state filter is handled
* in the basic PMC configuration of the accompanying regular
* PMU event, we ignore any separate BHRB specific request.
*/
/* Ignore user, kernel, hv bits */
branch_sample_type &= ~PERF_SAMPLE_BRANCH_PLM_ALL;
if (branch_sample_type == PERF_SAMPLE_BRANCH_ANY)
return pmu_bhrb_filter;
if (branch_sample_type == PERF_SAMPLE_BRANCH_ANY_CALL) {
pmu_bhrb_filter |= POWER8_MMCRA_IFM1;
return pmu_bhrb_filter;
}
if (branch_sample_type == PERF_SAMPLE_BRANCH_COND) {
pmu_bhrb_filter |= POWER8_MMCRA_IFM3;
return pmu_bhrb_filter;
}
/* Every thing else is unsupported */
return -1;
}
^ permalink raw reply
* Re: [1/3] powerpc/vfio: Enable on POWERNV platform
From: Scott Wood @ 2013-12-13 21:02 UTC (permalink / raw)
To: Alexey Kardashevskiy
Cc: kvm, linux-kernel, Bharat Bhushan, Alex Williamson,
Paul Mackerras, Varun Sethi, linuxppc-dev, David Gibson
In-Reply-To: <52AA78AE.2050800@ozlabs.ru>
On Fri, 2013-12-13 at 14:02 +1100, Alexey Kardashevskiy wrote:
> On 12/13/2013 10:35 AM, Scott Wood wrote:
> > On Tue, May 21, 2013 at 01:33:09PM +1000, Alexey Kardashevskiy wrote:
> >> +static int iommu_add_device(struct device *dev)
> >> +{
> >> + struct iommu_table *tbl;
> >> + int ret = 0;
> >> +
> >> + if (WARN_ON(dev->iommu_group)) {
> >> + pr_warn("iommu_tce: device %s is already in iommu group %d, skipping\n",
> >> + dev_name(dev),
> >> + iommu_group_id(dev->iommu_group));
> >> + return -EBUSY;
> >> + }
> > [snip]
> >> +static int __init tce_iommu_init(void)
> >> +{
> >> + struct pci_dev *pdev = NULL;
> >> +
> >> + BUILD_BUG_ON(PAGE_SIZE < IOMMU_PAGE_SIZE);
> >> +
> >> + for_each_pci_dev(pdev)
> >> + iommu_add_device(&pdev->dev);
> >> +
> >> + bus_register_notifier(&pci_bus_type, &tce_iommu_bus_nb);
> >> + return 0;
> >> +}
> >> +
> >> +subsys_initcall_sync(tce_iommu_init);
> >
> > This is missing a check to see whether the appropriate hardware is
> > present. This file should also be renamed to something less generic, and
> > depend on a kconfig symbol more specific than CONFIG_PPC64.
> >
> > When this is combined with CONFIG_FSL_PAMU on hardware with a PAMU, I get
> > a bunch of those "WARN_ON(dev->iommu_group)" dumps because PAMU already
> > got to them. Presumably without PAMU it silently (or with just pr_debug)
> > bails out at some other point.
>
>
> I posted (yet again) yesterday "[PATCH v11] PPC: POWERNV: move
> iommu_add_device earlier" which should fix this. And Bharat asked many
> times for this to get accepted :)
I still get the WARN_ONs even with that patch. You're still registering
the bus notifier unconditionally.
-Scott
^ permalink raw reply
* RE: [1/3] powerpc/vfio: Enable on POWERNV platform
From: Bharat.Bhushan @ 2013-12-14 4:56 UTC (permalink / raw)
To: Scott Wood, Alexey Kardashevskiy
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Alex Williamson, Paul Mackerras, Varun Sethi,
linuxppc-dev@lists.ozlabs.org, David Gibson
In-Reply-To: <1386968550.10013.320.camel@snotra.buserror.net>
DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogV29vZCBTY290dC1CMDc0
MjENCj4gU2VudDogU2F0dXJkYXksIERlY2VtYmVyIDE0LCAyMDEzIDI6MzMgQU0NCj4gVG86IEFs
ZXhleSBLYXJkYXNoZXZza2l5DQo+IENjOiBsaW51eHBwYy1kZXZAbGlzdHMub3psYWJzLm9yZzsg
a3ZtQHZnZXIua2VybmVsLm9yZzsgbGludXgtDQo+IGtlcm5lbEB2Z2VyLmtlcm5lbC5vcmc7IEFs
ZXggV2lsbGlhbXNvbjsgUGF1bCBNYWNrZXJyYXM7IERhdmlkIEdpYnNvbjsgU2V0aGkNCj4gVmFy
dW4tQjE2Mzk1OyBCaHVzaGFuIEJoYXJhdC1SNjU3NzcNCj4gU3ViamVjdDogUmU6IFsxLzNdIHBv
d2VycGMvdmZpbzogRW5hYmxlIG9uIFBPV0VSTlYgcGxhdGZvcm0NCj4gDQo+IE9uIEZyaSwgMjAx
My0xMi0xMyBhdCAxNDowMiArMTEwMCwgQWxleGV5IEthcmRhc2hldnNraXkgd3JvdGU6DQo+ID4g
T24gMTIvMTMvMjAxMyAxMDozNSBBTSwgU2NvdHQgV29vZCB3cm90ZToNCj4gPiA+IE9uIFR1ZSwg
TWF5IDIxLCAyMDEzIGF0IDAxOjMzOjA5UE0gKzEwMDAsIEFsZXhleSBLYXJkYXNoZXZza2l5IHdy
b3RlOg0KPiA+ID4+ICtzdGF0aWMgaW50IGlvbW11X2FkZF9kZXZpY2Uoc3RydWN0IGRldmljZSAq
ZGV2KSB7DQo+ID4gPj4gKwlzdHJ1Y3QgaW9tbXVfdGFibGUgKnRibDsNCj4gPiA+PiArCWludCBy
ZXQgPSAwOw0KPiA+ID4+ICsNCj4gPiA+PiArCWlmIChXQVJOX09OKGRldi0+aW9tbXVfZ3JvdXAp
KSB7DQo+ID4gPj4gKwkJcHJfd2FybigiaW9tbXVfdGNlOiBkZXZpY2UgJXMgaXMgYWxyZWFkeSBp
biBpb21tdSBncm91cCAlZCwNCj4gc2tpcHBpbmdcbiIsDQo+ID4gPj4gKwkJCQlkZXZfbmFtZShk
ZXYpLA0KPiA+ID4+ICsJCQkJaW9tbXVfZ3JvdXBfaWQoZGV2LT5pb21tdV9ncm91cCkpOw0KPiA+
ID4+ICsJCXJldHVybiAtRUJVU1k7DQo+ID4gPj4gKwl9DQo+ID4gPiBbc25pcF0NCj4gPiA+PiAr
c3RhdGljIGludCBfX2luaXQgdGNlX2lvbW11X2luaXQodm9pZCkgew0KPiA+ID4+ICsJc3RydWN0
IHBjaV9kZXYgKnBkZXYgPSBOVUxMOw0KPiA+ID4+ICsNCj4gPiA+PiArCUJVSUxEX0JVR19PTihQ
QUdFX1NJWkUgPCBJT01NVV9QQUdFX1NJWkUpOw0KPiA+ID4+ICsNCj4gPiA+PiArCWZvcl9lYWNo
X3BjaV9kZXYocGRldikNCj4gPiA+PiArCQlpb21tdV9hZGRfZGV2aWNlKCZwZGV2LT5kZXYpOw0K
PiA+ID4+ICsNCj4gPiA+PiArCWJ1c19yZWdpc3Rlcl9ub3RpZmllcigmcGNpX2J1c190eXBlLCAm
dGNlX2lvbW11X2J1c19uYik7DQo+ID4gPj4gKwlyZXR1cm4gMDsNCj4gPiA+PiArfQ0KPiA+ID4+
ICsNCj4gPiA+PiArc3Vic3lzX2luaXRjYWxsX3N5bmModGNlX2lvbW11X2luaXQpOw0KPiA+ID4N
Cj4gPiA+IFRoaXMgaXMgbWlzc2luZyBhIGNoZWNrIHRvIHNlZSB3aGV0aGVyIHRoZSBhcHByb3By
aWF0ZSBoYXJkd2FyZSBpcw0KPiA+ID4gcHJlc2VudC4gIFRoaXMgZmlsZSBzaG91bGQgYWxzbyBi
ZSByZW5hbWVkIHRvIHNvbWV0aGluZyBsZXNzDQo+ID4gPiBnZW5lcmljLCBhbmQgZGVwZW5kIG9u
IGEga2NvbmZpZyBzeW1ib2wgbW9yZSBzcGVjaWZpYyB0aGFuIENPTkZJR19QUEM2NC4NCj4gPiA+
DQo+ID4gPiBXaGVuIHRoaXMgaXMgY29tYmluZWQgd2l0aCBDT05GSUdfRlNMX1BBTVUgb24gaGFy
ZHdhcmUgd2l0aCBhIFBBTVUsDQo+ID4gPiBJIGdldCBhIGJ1bmNoIG9mIHRob3NlICJXQVJOX09O
KGRldi0+aW9tbXVfZ3JvdXApIiBkdW1wcyBiZWNhdXNlDQo+ID4gPiBQQU1VIGFscmVhZHkgZ290
IHRvIHRoZW0uICBQcmVzdW1hYmx5IHdpdGhvdXQgUEFNVSBpdCBzaWxlbnRseSAob3INCj4gPiA+
IHdpdGgganVzdCBwcl9kZWJ1ZykgYmFpbHMgb3V0IGF0IHNvbWUgb3RoZXIgcG9pbnQuDQo+ID4N
Cj4gPg0KPiA+IEkgcG9zdGVkICh5ZXQgYWdhaW4pIHllc3RlcmRheSAiW1BBVENIIHYxMV0gUFBD
OiBQT1dFUk5WOiBtb3ZlDQo+ID4gaW9tbXVfYWRkX2RldmljZSBlYXJsaWVyIiB3aGljaCBzaG91
bGQgZml4IHRoaXMuIEFuZCBCaGFyYXQgYXNrZWQgbWFueQ0KPiA+IHRpbWVzIGZvciB0aGlzIHRv
IGdldCBhY2NlcHRlZCA6KQ0KPiANCj4gSSBzdGlsbCBnZXQgdGhlIFdBUk5fT05zIGV2ZW4gd2l0
aCB0aGF0IHBhdGNoLiAgWW91J3JlIHN0aWxsIHJlZ2lzdGVyaW5nIHRoZSBidXMNCj4gbm90aWZp
ZXIgdW5jb25kaXRpb25hbGx5Lg0KDQpJIGhhdmUgbm90IHRyaWVkIHYxMSBidXQgdGVzdGVkIFY5
IHZlcnNpb24gb2YgdGhhdCBwYXRjaC4gQW5kIHllcywgaW4gdGhhdCB2ZXJzaW9uIHRoZSBidXMg
bm90aWZpZXIgd2FzIG5vdCByZWdpc3RlcmVkIHVuY29uZGl0aW9uYWxseSBpbiBrZXJuZWwvaW9t
bXUuYyAuDQoNClRoYW5rcw0KLUJoYXJhdA0KDQo+IA0KPiAtU2NvdHQNCj4gDQoNCg==
^ permalink raw reply
* RE: [PATCH v11] PPC: POWERNV: move iommu_add_device earlier
From: Bharat.Bhushan @ 2013-12-14 4:57 UTC (permalink / raw)
To: Alexey Kardashevskiy, linuxppc-dev@lists.ozlabs.org
Cc: Alex Graf, linux-kernel@vger.kernel.org
In-Reply-To: <1386834869-15561-1-git-send-email-aik@ozlabs.ru>
> -----Original Message-----
> From: Alexey Kardashevskiy [mailto:aik@ozlabs.ru]
> Sent: Thursday, December 12, 2013 1:24 PM
> To: linuxppc-dev@lists.ozlabs.org
> Cc: Alexey Kardashevskiy; Benjamin Herrenschmidt; Bhushan Bharat-R65777; =
Alex
> Graf; linux-kernel@vger.kernel.org
> Subject: [PATCH v11] PPC: POWERNV: move iommu_add_device earlier
>=20
> The current implementation of IOMMU on sPAPR does not use iommu_ops
> and therefore does not call IOMMU API's bus_set_iommu() which
> 1) sets iommu_ops for a bus
> 2) registers a bus notifier
> Instead, PCI devices are added to IOMMU groups from
> subsys_initcall_sync(tce_iommu_init) which does basically the same
> thing without using iommu_ops callbacks.
>=20
> However Freescale PAMU driver (https://lkml.org/lkml/2013/7/1/158)
> implements iommu_ops and when tce_iommu_init is called, every PCI device
> is already added to some group so there is a conflict.
>=20
> This patch does 2 things:
> 1. removes the loop in which PCI devices were added to groups and
> adds explicit iommu_add_device() calls to add devices as soon as they get
> the iommu_table pointer assigned to them.
> 2. moves a bus notifier to powernv code in order to avoid conflict with
> the notifier from Freescale driver.
>=20
> iommu_add_device() and iommu_del_device() are public now.
>=20
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
> Changes:
> v11:
> * rebased on upstream
>=20
> v10:
> * fixed linker error when IOMMU_API is not enabled
>=20
> v9:
> * removed "KVM" from the subject as it is not really a KVM patch so
> PPC mainainter (hi Ben!) can review/include it into his tree
>=20
> v8:
> * added the check for iommu_group!=3DNULL before removing device from a g=
roup
> as suggested by Wei Yang <weiyang@linux.vnet.ibm.com>
>=20
> v2:
> * added a helper - set_iommu_table_base_and_group - which does
> set_iommu_table_base() and iommu_add_device()
> ---
> arch/powerpc/include/asm/iommu.h | 26 +++++++++++++++++++++++=
+
> arch/powerpc/kernel/iommu.c | 11 ++++------
> arch/powerpc/platforms/powernv/pci-ioda.c | 8 ++++----
> arch/powerpc/platforms/powernv/pci-p5ioc2.c | 2 +-
> arch/powerpc/platforms/powernv/pci.c | 31 +++++++++++++++++++++++=
+++++-
> arch/powerpc/platforms/pseries/iommu.c | 8 +++++---
> 6 files changed, 70 insertions(+), 16 deletions(-)
>=20
> diff --git a/arch/powerpc/include/asm/iommu.h b/arch/powerpc/include/asm/=
iommu.h
> index c34656a..774fa27 100644
> --- a/arch/powerpc/include/asm/iommu.h
> +++ b/arch/powerpc/include/asm/iommu.h
> @@ -101,8 +101,34 @@ extern void iommu_free_table(struct iommu_table *tbl=
, const
> char *node_name);
> */
> extern struct iommu_table *iommu_init_table(struct iommu_table * tbl,
> int nid);
> +#ifdef CONFIG_IOMMU_API
> extern void iommu_register_group(struct iommu_table *tbl,
> int pci_domain_number, unsigned long pe_num);
> +extern int iommu_add_device(struct device *dev);
> +extern void iommu_del_device(struct device *dev);
> +#else
> +static inline void iommu_register_group(struct iommu_table *tbl,
> + int pci_domain_number,
> + unsigned long pe_num)
> +{
> +}
> +
> +static inline int iommu_add_device(struct device *dev)
> +{
> + return 0;
> +}
> +
> +static inline void iommu_del_device(struct device *dev)
> +{
> +}
> +#endif /* !CONFIG_IOMMU_API */
> +
> +static inline void set_iommu_table_base_and_group(struct device *dev,
> + void *base)
> +{
> + set_iommu_table_base(dev, base);
> + iommu_add_device(dev);
> +}
>=20
> extern int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
> struct scatterlist *sglist, int nelems,
> diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
> index 572bb5b..818a092 100644
> --- a/arch/powerpc/kernel/iommu.c
> +++ b/arch/powerpc/kernel/iommu.c
> @@ -1105,7 +1105,7 @@ void iommu_release_ownership(struct iommu_table *tb=
l)
> }
> EXPORT_SYMBOL_GPL(iommu_release_ownership);
>=20
> -static int iommu_add_device(struct device *dev)
> +int iommu_add_device(struct device *dev)
> {
> struct iommu_table *tbl;
> int ret =3D 0;
> @@ -1134,11 +1134,13 @@ static int iommu_add_device(struct device *dev)
>=20
> return ret;
> }
> +EXPORT_SYMBOL_GPL(iommu_add_device);
>=20
> -static void iommu_del_device(struct device *dev)
> +void iommu_del_device(struct device *dev)
> {
> iommu_group_remove_device(dev);
> }
> +EXPORT_SYMBOL_GPL(iommu_del_device);
>=20
> static int iommu_bus_notifier(struct notifier_block *nb,
> unsigned long action, void *data)
> @@ -1162,13 +1164,8 @@ static struct notifier_block tce_iommu_bus_nb =3D =
{
>=20
> static int __init tce_iommu_init(void)
> {
> - struct pci_dev *pdev =3D NULL;
> -
> BUILD_BUG_ON(PAGE_SIZE < IOMMU_PAGE_SIZE);
>=20
> - for_each_pci_dev(pdev)
> - iommu_add_device(&pdev->dev);
> -
> bus_register_notifier(&pci_bus_type, &tce_iommu_bus_nb);
> return 0;
> }
Do we need this bus notifier? We are doing a bus notifier later ....=20
> diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c
> b/arch/powerpc/platforms/powernv/pci-ioda.c
> index 2c6d173..f0e6871 100644
> --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> @@ -460,7 +460,7 @@ static void pnv_pci_ioda_dma_dev_setup(struct pnv_phb=
*phb,
> struct pci_dev *pdev
> return;
>=20
> pe =3D &phb->ioda.pe_array[pdn->pe_number];
> - set_iommu_table_base(&pdev->dev, &pe->tce32_table);
> + set_iommu_table_base_and_group(&pdev->dev, &pe->tce32_table);
> }
>=20
> static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, struct pci_bu=
s *bus)
> @@ -468,7 +468,7 @@ static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe=
*pe,
> struct pci_bus *bus)
> struct pci_dev *dev;
>=20
> list_for_each_entry(dev, &bus->devices, bus_list) {
> - set_iommu_table_base(&dev->dev, &pe->tce32_table);
> + set_iommu_table_base_and_group(&dev->dev, &pe->tce32_table);
> if (dev->subordinate)
> pnv_ioda_setup_bus_dma(pe, dev->subordinate);
> }
> @@ -644,7 +644,7 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb =
*phb,
> iommu_register_group(tbl, pci_domain_nr(pe->pbus), pe->pe_number);
>=20
> if (pe->pdev)
> - set_iommu_table_base(&pe->pdev->dev, tbl);
> + set_iommu_table_base_and_group(&pe->pdev->dev, tbl);
> else
> pnv_ioda_setup_bus_dma(pe, pe->pbus);
>=20
> @@ -723,7 +723,7 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb=
*phb,
> iommu_register_group(tbl, pci_domain_nr(pe->pbus), pe->pe_number);
>=20
> if (pe->pdev)
> - set_iommu_table_base(&pe->pdev->dev, tbl);
> + set_iommu_table_base_and_group(&pe->pdev->dev, tbl);
> else
> pnv_ioda_setup_bus_dma(pe, pe->pbus);
>=20
> diff --git a/arch/powerpc/platforms/powernv/pci-p5ioc2.c
> b/arch/powerpc/platforms/powernv/pci-p5ioc2.c
> index f8b4bd8..e3807d6 100644
> --- a/arch/powerpc/platforms/powernv/pci-p5ioc2.c
> +++ b/arch/powerpc/platforms/powernv/pci-p5ioc2.c
> @@ -92,7 +92,7 @@ static void pnv_pci_p5ioc2_dma_dev_setup(struct pnv_phb=
*phb,
> pci_domain_nr(phb->hose->bus), phb->opal_id);
> }
>=20
> - set_iommu_table_base(&pdev->dev, &phb->p5ioc2.iommu_table);
> + set_iommu_table_base_and_group(&pdev->dev, &phb->p5ioc2.iommu_table);
> }
>=20
> static void __init pnv_pci_init_p5ioc2_phb(struct device_node *np, u64 h=
ub_id,
> diff --git a/arch/powerpc/platforms/powernv/pci.c
> b/arch/powerpc/platforms/powernv/pci.c
> index 4eb33a9..a78abad 100644
> --- a/arch/powerpc/platforms/powernv/pci.c
> +++ b/arch/powerpc/platforms/powernv/pci.c
> @@ -536,7 +536,7 @@ static void pnv_pci_dma_fallback_setup(struct pci_con=
troller
> *hose,
> pdn->iommu_table =3D pnv_pci_setup_bml_iommu(hose);
> if (!pdn->iommu_table)
> return;
> - set_iommu_table_base(&pdev->dev, pdn->iommu_table);
> + set_iommu_table_base_and_group(&pdev->dev, pdn->iommu_table);
> }
>=20
> static void pnv_pci_dma_dev_setup(struct pci_dev *pdev)
> @@ -657,3 +657,32 @@ void __init pnv_pci_init(void)
> ppc_md.teardown_msi_irqs =3D pnv_teardown_msi_irqs;
> #endif
> }
> +
> +static int tce_iommu_bus_notifier(struct notifier_block *nb,
> + unsigned long action, void *data)
> +{
> + struct device *dev =3D data;
> +
> + switch (action) {
> + case BUS_NOTIFY_ADD_DEVICE:
> + return iommu_add_device(dev);
> + case BUS_NOTIFY_DEL_DEVICE:
> + if (dev->iommu_group)
> + iommu_del_device(dev);
> + return 0;
> + default:
> + return 0;
> + }
> +}
> +
> +static struct notifier_block tce_iommu_bus_nb =3D {
> + .notifier_call =3D tce_iommu_bus_notifier,
> +};
> +
> +static int __init tce_iommu_bus_notifier_init(void)
> +{
> + bus_register_notifier(&pci_bus_type, &tce_iommu_bus_nb);
Here it is, setting up the bus notifier.
Thanks
-Bharat
> + return 0;
> +}
> +
> +subsys_initcall_sync(tce_iommu_bus_notifier_init);
> diff --git a/arch/powerpc/platforms/pseries/iommu.c
> b/arch/powerpc/platforms/pseries/iommu.c
> index f253361..a80af6c 100644
> --- a/arch/powerpc/platforms/pseries/iommu.c
> +++ b/arch/powerpc/platforms/pseries/iommu.c
> @@ -687,7 +687,8 @@ static void pci_dma_dev_setup_pSeries(struct pci_dev =
*dev)
> iommu_table_setparms(phb, dn, tbl);
> PCI_DN(dn)->iommu_table =3D iommu_init_table(tbl, phb->node);
> iommu_register_group(tbl, pci_domain_nr(phb->bus), 0);
> - set_iommu_table_base(&dev->dev, PCI_DN(dn)->iommu_table);
> + set_iommu_table_base_and_group(&dev->dev,
> + PCI_DN(dn)->iommu_table);
> return;
> }
>=20
> @@ -699,7 +700,8 @@ static void pci_dma_dev_setup_pSeries(struct pci_dev =
*dev)
> dn =3D dn->parent;
>=20
> if (dn && PCI_DN(dn))
> - set_iommu_table_base(&dev->dev, PCI_DN(dn)->iommu_table);
> + set_iommu_table_base_and_group(&dev->dev,
> + PCI_DN(dn)->iommu_table);
> else
> printk(KERN_WARNING "iommu: Device %s has no iommu table\n",
> pci_name(dev));
> @@ -1193,7 +1195,7 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_=
dev
> *dev)
> pr_debug(" found DMA window, table: %p\n", pci->iommu_table);
> }
>=20
> - set_iommu_table_base(&dev->dev, pci->iommu_table);
> + set_iommu_table_base_and_group(&dev->dev, pci->iommu_table);
> }
>=20
> static int dma_set_mask_pSeriesLP(struct device *dev, u64 dma_mask)
> --
> 1.8.4.rc4
>=20
>=20
^ permalink raw reply
* [GIT PULL locking/mb] Locking/memory-barrier commits
From: Paul E. McKenney @ 2013-12-14 7:48 UTC (permalink / raw)
To: mingo
Cc: linux-arch, linuxppc-dev, corbet, peterz, rusty, oleg, josh,
dhowells, paulus, torvalds
Hello, Ingo,
This pull request contains additions to the memory-barrier documentation,
along with a downgrading of UNLOCK+LOCK to no longer be a full memory
barrier, and finally an smp_mb__after_unlock_lock() that allows upgrading
a particular LOCK to pair with a preceding UNLOCK to form a full memory
barrier, and application of smp_mb__after_unlock_lock() to RCU.
The first four documentation commits are ready for 3.14:
b145f8acfd82 (Add needed ACCESS_ONCE() calls to memory-barriers.txt)
6be08d626389 (Add long atomic examples to memory-barriers.txt)
c89bb78cfbe1 (Prohibit speculative writes)
b2ba08be67fc (Document ACCESS_ONCE())
The remaining commits might or might not be, but are at a point where
getting them into -tip is appropriate given other changes in this area,
e.g., Peter's smp_load_acquire() and smp_store_release().
These changes are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git locking/mb
for you to fetch changes up to 9f9df17e265b2c5aea11a95e3e69269d005ac0ae:
powerpc: Full barrier for smp_mb__after_unlock_lock() (2013-12-13 09:05:13 -0800)
----------------------------------------------------------------
Paul E. McKenney (7):
Documentation/memory-barriers.txt: Add needed ACCESS_ONCE() calls to memory-barriers.txt
Documentation/memory-barriers.txt: Add long atomic examples to memory-barriers.txt
Documentation/memory-barriers.txt: Document ACCESS_ONCE()
locking: Add an smp_mb__after_unlock_lock() for UNLOCK+LOCK barrier
Documentation/memory-barriers.txt: Downgrade UNLOCK+LOCK
rcu: Apply smp_mb__after_unlock_lock() to preserve grace periods
powerpc: Full barrier for smp_mb__after_unlock_lock()
Peter Zijlstra (1):
Documentation/memory-barriers.txt: Prohibit speculative writes
Documentation/memory-barriers.txt | 733 ++++++++++++++++++++++++++++++------
arch/powerpc/include/asm/spinlock.h | 2 +
include/linux/spinlock.h | 10 +
kernel/rcu/tree.c | 18 +-
kernel/rcu/tree_plugin.h | 13 +
5 files changed, 661 insertions(+), 115 deletions(-)
^ permalink raw reply
* [PATCH 05/10] powerpc: select ARCH_MIGHT_HAVE_PC_SERIO
From: Mark Salter @ 2013-12-14 16:59 UTC (permalink / raw)
To: linux-kernel; +Cc: Paul Mackerras, linuxppc-dev, Mark Salter
In-Reply-To: <1387040376-26906-1-git-send-email-msalter@redhat.com>
Architectures which might use an i8042 for serial IO to keyboard,
mouse, etc should select ARCH_MIGHT_HAVE_PC_SERIO.
Signed-off-by: Mark Salter <msalter@redhat.com>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Paul Mackerras <paulus@samba.org>
CC: linuxppc-dev@lists.ozlabs.org
---
arch/powerpc/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index b44b52c..fb75485 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -86,6 +86,7 @@ config PPC
bool
default y
select ARCH_MIGHT_HAVE_PC_PARPORT
+ select ARCH_MIGHT_HAVE_PC_SERIO
select BINFMT_ELF
select OF
select OF_EARLY_FLATTREE
--
1.8.3.1
^ permalink raw reply related
* [PATCH 10/10] Kconfig: cleanup SERIO_I8042 dependencies
From: Mark Salter @ 2013-12-14 16:59 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mips, linux-ia64, linux-sh, Paul Mackerras, H. Peter Anvin,
sparclinux, Guan Xuetao, Russell King, x86, Ingo Molnar,
Mark Salter, Fenghua Yu, Thomas Gleixner, linux-arm-kernel,
Richard Henderson, Tony Luck, Dmitry Torokhov, Ralf Baechle,
Paul Mundt, linux-alpha, linuxppc-dev, David S. Miller
In-Reply-To: <1387040376-26906-1-git-send-email-msalter@redhat.com>
Remove messy dependencies from SERIO_I8042 by having it depend on one
Kconfig symbol (ARCH_MIGHT_HAVE_PC_SERIO) and having architectures
which need it select ARCH_MIGHT_HAVE_PC_SERIO in arch/*/Kconfig.
New architectures are unlikely to need SERIO_I8042, so this avoids
having an ever growing list of architectures to exclude.
Signed-off-by: Mark Salter <msalter@redhat.com>
CC: Dmitry Torokhov <dmitry.torokhov@gmail.com>
CC: Richard Henderson <rth@twiddle.net>
CC: linux-alpha@vger.kernel.org
CC: Russell King <linux@arm.linux.org.uk>
CC: linux-arm-kernel@lists.infradead.org
CC: Tony Luck <tony.luck@intel.com>
CC: Fenghua Yu <fenghua.yu@intel.com>
CC: linux-ia64@vger.kernel.org
CC: Ralf Baechle <ralf@linux-mips.org>
CC: linux-mips@linux-mips.org
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Paul Mackerras <paulus@samba.org>
CC: linuxppc-dev@lists.ozlabs.org
CC: Paul Mundt <lethal@linux-sh.org>
CC: linux-sh@vger.kernel.org
CC: "David S. Miller" <davem@davemloft.net>
CC: sparclinux@vger.kernel.org
CC: Guan Xuetao <gxt@mprc.pku.edu.cn>
CC: Ingo Molnar <mingo@redhat.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: "H. Peter Anvin" <hpa@zytor.com>
CC: x86@kernel.org
---
drivers/input/serio/Kconfig | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig
index 8541f94..1f5cec2 100644
--- a/drivers/input/serio/Kconfig
+++ b/drivers/input/serio/Kconfig
@@ -16,14 +16,19 @@ config SERIO
To compile this driver as a module, choose M here: the
module will be called serio.
+config ARCH_MIGHT_HAVE_PC_SERIO
+ bool
+ help
+ Select this config option from the architecture Kconfig if
+ the architecture might use a PC serio device (i8042) to
+ communicate with keyboard, mouse, etc.
+
if SERIO
config SERIO_I8042
tristate "i8042 PC Keyboard controller"
default y
- depends on !PARISC && (!ARM || FOOTBRIDGE_HOST) && \
- (!SUPERH || SH_CAYMAN) && !M68K && !BLACKFIN && !S390 && \
- !ARC
+ depends on ARCH_MIGHT_HAVE_PC_SERIO
help
i8042 is the chip over which the standard AT keyboard and PS/2
mouse are connected to the computer. If you use these devices,
--
1.8.3.1
^ permalink raw reply related
* Re: 3.13-rc1: eth0 hw csum failure on powerpc (bisected)
From: Christian Kujau @ 2013-12-15 0:40 UTC (permalink / raw)
To: Andreas Schwab, davem; +Cc: netdev, linuxppc-dev, LKML, Alexander Graf
In-Reply-To: <87vbz9pmud.fsf@igel.home>
On Sat, 30 Nov 2013 at 23:05, Andreas Schwab wrote:
> >> > [...]
> >> > Freeing unused kernel memory: 204K (c06ea000 - c071d000)
> >> > eth0: hw csum failure
> >> > CPU: 0 PID: 0 Comm: swapper Not tainted 3.13.0-rc2 #1
> >> > Call Trace:
> >>
> >> Btw, full dmesg & .config: http://nerdbynature.de/bits/3.13-rc1/
> >
> > Oh, this has already been reported earlier this week:
> >
> > https://lists.ozlabs.org/pipermail/linuxppc-dev/2013-November/113584.html
>
> No solution yet, though, 3.13-rc2 is still broken.
As 3.13-rc3 was still broken, I tried a git-bisect, resulting in:
018c5bba052b3a383d83cf0c756da0e7bc748397 is the first bad commit
commit 018c5bba052b3a383d83cf0c756da0e7bc748397
Author: David S. Miller <davem@davemloft.net>
Date: Fri Nov 15 21:11:16 2013 -0500
net: Handle CHECKSUM_COMPLETE more adequately in pskb_trim_rcsum().
Currently pskb_trim_rcsum() just balks on CHECKSUM_COMPLETE packets
and remarks them as CHECKSUM_NONE, forcing a software checksum
validation later.
We have all of the mechanics available to fixup the skb->csum value,
even for complicated fragmented packets, via the helpers
skb_checksum() and csum_sub().
So just use them.
Based upon a suggestion by Herbert Xu.
Signed-off-by: David S. Miller <davem@davemloft.net>
:040000 040000 14e295c30c2d2a1164f4eb70aaec821fbe288c01 456c666ebbb355292b683c71c85585fc6d07e852 M include
And sure enough, today's 3.13-rc3 with only that commit reverted boots
just fine on this PowerBook G4 system.
Thanks,
Christian
--
BOFH excuse #152:
My pony-tail hit the on/off switch on the power strip.
^ permalink raw reply
* Re: [PATCH 10/10] Kconfig: cleanup SERIO_I8042 dependencies
From: H. Peter Anvin @ 2013-12-14 18:32 UTC (permalink / raw)
To: Mark Salter, linux-kernel
Cc: Fenghua Yu, Tony Luck, Russell King, linux-mips, linux-sh,
Dmitry Torokhov, x86, Ralf Baechle, Ingo Molnar, Paul Mundt,
Paul Mackerras, linux-alpha, sparclinux, linux-ia64,
Thomas Gleixner, Guan Xuetao, linuxppc-dev, David S. Miller,
linux-arm-kernel, Richard Henderson
In-Reply-To: <1387040376-26906-11-git-send-email-msalter@redhat.com>
On 12/14/2013 08:59 AM, Mark Salter wrote:
> Remove messy dependencies from SERIO_I8042 by having it depend on one
> Kconfig symbol (ARCH_MIGHT_HAVE_PC_SERIO) and having architectures
> which need it select ARCH_MIGHT_HAVE_PC_SERIO in arch/*/Kconfig.
> New architectures are unlikely to need SERIO_I8042, so this avoids
> having an ever growing list of architectures to exclude.
>
> Signed-off-by: Mark Salter <msalter@redhat.com>
> CC: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> CC: Richard Henderson <rth@twiddle.net>
> CC: linux-alpha@vger.kernel.org
> CC: Russell King <linux@arm.linux.org.uk>
> CC: linux-arm-kernel@lists.infradead.org
> CC: Tony Luck <tony.luck@intel.com>
> CC: Fenghua Yu <fenghua.yu@intel.com>
> CC: linux-ia64@vger.kernel.org
> CC: Ralf Baechle <ralf@linux-mips.org>
> CC: linux-mips@linux-mips.org
> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> CC: Paul Mackerras <paulus@samba.org>
> CC: linuxppc-dev@lists.ozlabs.org
> CC: Paul Mundt <lethal@linux-sh.org>
> CC: linux-sh@vger.kernel.org
> CC: "David S. Miller" <davem@davemloft.net>
> CC: sparclinux@vger.kernel.org
> CC: Guan Xuetao <gxt@mprc.pku.edu.cn>
> CC: Ingo Molnar <mingo@redhat.com>
> CC: Thomas Gleixner <tglx@linutronix.de>
> CC: "H. Peter Anvin" <hpa@zytor.com>
> CC: x86@kernel.org
Acked-by: H. Peter Anvin <hpa@linux.intel.com>
^ permalink raw reply
* Re: 3.13-rc1: eth0 hw csum failure on powerpc (bisected)
From: David Miller @ 2013-12-15 3:34 UTC (permalink / raw)
To: lists; +Cc: netdev, agraf, schwab, linuxppc-dev, linux-kernel
In-Reply-To: <alpine.DEB.2.11.1312141622230.25690@trent.utfs.org>
From: Christian Kujau <lists@nerdbynature.de>
Date: Sat, 14 Dec 2013 16:40:39 -0800 (PST)
> And sure enough, today's 3.13-rc3 with only that commit reverted boots
> just fine on this PowerBook G4 system.
It's reverted in my 'net' tree, that tree simple hasn't been pushed to
Linus just yet, please be patient.
^ permalink raw reply
* Re: [PATCH 10/10] Kconfig: cleanup SERIO_I8042 dependencies
From: Dmitry Torokhov @ 2013-12-15 10:36 UTC (permalink / raw)
To: H. Peter Anvin
Cc: linux-mips, linux-ia64, linux-sh, Paul Mackerras, sparclinux,
Guan Xuetao, Russell King, x86, Ingo Molnar, Mark Salter,
Fenghua Yu, Thomas Gleixner, linux-arm-kernel, Richard Henderson,
Tony Luck, linux-kernel, Ralf Baechle, Paul Mundt, linux-alpha,
linuxppc-dev, David S. Miller
In-Reply-To: <52ACA43F.2040402@zytor.com>
On Sat, Dec 14, 2013 at 10:32:31AM -0800, H. Peter Anvin wrote:
> On 12/14/2013 08:59 AM, Mark Salter wrote:
> > Remove messy dependencies from SERIO_I8042 by having it depend on one
> > Kconfig symbol (ARCH_MIGHT_HAVE_PC_SERIO) and having architectures
> > which need it select ARCH_MIGHT_HAVE_PC_SERIO in arch/*/Kconfig.
> > New architectures are unlikely to need SERIO_I8042, so this avoids
> > having an ever growing list of architectures to exclude.
> >
> > Signed-off-by: Mark Salter <msalter@redhat.com>
> > CC: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > CC: Richard Henderson <rth@twiddle.net>
> > CC: linux-alpha@vger.kernel.org
> > CC: Russell King <linux@arm.linux.org.uk>
> > CC: linux-arm-kernel@lists.infradead.org
> > CC: Tony Luck <tony.luck@intel.com>
> > CC: Fenghua Yu <fenghua.yu@intel.com>
> > CC: linux-ia64@vger.kernel.org
> > CC: Ralf Baechle <ralf@linux-mips.org>
> > CC: linux-mips@linux-mips.org
> > CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > CC: Paul Mackerras <paulus@samba.org>
> > CC: linuxppc-dev@lists.ozlabs.org
> > CC: Paul Mundt <lethal@linux-sh.org>
> > CC: linux-sh@vger.kernel.org
> > CC: "David S. Miller" <davem@davemloft.net>
> > CC: sparclinux@vger.kernel.org
> > CC: Guan Xuetao <gxt@mprc.pku.edu.cn>
> > CC: Ingo Molnar <mingo@redhat.com>
> > CC: Thomas Gleixner <tglx@linutronix.de>
> > CC: "H. Peter Anvin" <hpa@zytor.com>
> > CC: x86@kernel.org
>
> Acked-by: H. Peter Anvin <hpa@linux.intel.com>
How are we going to merge this? In bulk through input tree or peacemeal
through all arches first?
--
Dmitry
^ permalink raw reply
* Re: [PATCH v3] powerpc: Fix PTE page address mismatch in pgtable ctor/dtor
From: Sebastian Andrzej Siewior @ 2013-12-15 12:59 UTC (permalink / raw)
To: Hong H. Pham
Cc: linux-rt-users, linux-stable, Paul Mackerras, Aneesh Kumar K.V,
linuxppc-dev
In-Reply-To: <1386425193-24015-1-git-send-email-hong.pham@windriver.com>
* Hong H. Pham | 2013-12-07 09:06:33 [-0500]:
>On PPC32, only SMP kernels are affected.
>
>On PPC64, only SMP kernels with 4K page size are affected.
$ uname -a
Linux mpc8536-1 3.12.1-rt3-00281-g9de268d #76 SMP PREEMPT RT Fri Nov 22 16:53:05 CET 2013 ppc GNU/Linux
$ uptime
22:01:10 up 22 days, 21:01, 1 user, load average: 443.08, 563.59, 586.20
This is from a mpc8536 box. The high load comes from a hackbench that was
running for quite some time. Are Book-E (CONFIG_PPC_BOOK3E_MMU without
CONFIG_PPC_BOOK3E set) not affected or is this bug not present if a SMP
kernel is booted on a UP machine?
Sebastian
^ permalink raw reply
* [RFC PATCH v3] powerpc: Loading kernels over 8Mbytes without CONFIG_PIN_TLB
From: Christophe Leroy @ 2013-12-15 15:09 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, scottwood
Cc: linuxppc-dev, linux-kernel
Hereunder is a try to implement the sizing of the initial memory size based=
on
initial-mapped-area size given by uboot in r7.
As this has an impact on all powerpc platforms due to the need to provide t=
he
info up to function setup_initial_memory_limit(), I'm not completly sure of=
the
proper implementation.
Thanks to provide comments.
Today on the 8xx, the only way to load kernels whose size is greater than
8Mbytes is to activate CONFIG_PIN_TLB. Otherwise, the physical memory initi=
ally
mapped is limited to 8Mbytes. This patch uses the size of initial memory ma=
pped
by the bootloader and given to the kernel through register r7.
This is done regardless of whether CONFIG_PIN_TLB is active or not. It allo=
ws to
load "big" kernels (for instance when activating CONFIG_LOCKDEP_SUPPORT) wi=
thout
having to activate CONFIG_PIN_TLB.
Not-yet-signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Index: linux/arch/powerpc/include/asm/mmu.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- linux/arch/powerpc/include/asm/mmu.h (revision 5484)
+++ linux/arch/powerpc/include/asm/mmu.h (copie de travail)
@@ -138,7 +138,8 @@
extern void early_init_mmu_secondary(void);
extern void setup_initial_memory_limit(phys_addr_t first_memblock_base,
- phys_addr_t first_memblock_size);
+ phys_addr_t first_memblock_size,
+ u64 init_mem_size);
#ifdef CONFIG_PPC64
/* This is our real memory area size on ppc64 server, on embedded, we
Index: linux/arch/powerpc/kernel/head_8xx.S
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- linux/arch/powerpc/kernel/head_8xx.S (revision 5484)
+++ linux/arch/powerpc/kernel/head_8xx.S (copie de travail)
@@ -31,6 +31,8 @@
#include <asm/asm-offsets.h>
#include <asm/ptrace.h>
+#define EPAPR_MAGIC 0x65504150
+
/* Macro to make the code more readable. */
#ifdef CONFIG_8xx_CPU6
#define DO_8xx_CPU6(val, reg) \
@@ -77,10 +79,19 @@
.globl __start
__start:
mr r31,r3 /* save device tree ptr */
+ li r30,0
+ lis r8,EPAPR_MAGIC@h
+ ori r8,r8, EPAPR_MAGIC@l
+ cmpw cr0,r8, r6
+ bne 1f
+
+ mr r30,r7 /* save initial ram size */
+
/* We have to turn on the MMU right away so we get cache modes
* set correctly.
*/
+1:
bl initial_mmu
/* We now have the lower 8 Meg mapped into TLB entries, and the caches
@@ -717,6 +728,8 @@
*/
li r3,0
mr r4,r31
+ li r5,0
+ mr r6,r30
bl machine_init
bl MMU_init
@@ -841,11 +854,17 @@
ori r8, r8, MI_BOOTINIT|0x2 /* Inhibit cache -- Cort */
mtspr SPRN_MD_RPN, r8
+ /* Map two more 8M kernel data pages if needed
+ * We check how much memory is mapped by the bootloader
+ */
+ lis r8, 0x0100
+ cmplw cr0, r8, r30
+ blt 2f
+
#ifdef CONFIG_PIN_TLB
- /* Map two more 8M kernel data pages.
- */
addi r10, r10, 0x0100
mtspr SPRN_MD_CTR, r10
+#endif
lis r8, KERNELBASE@h /* Create vaddr for TLB */
addis r8, r8, 0x0080 /* Add 8M */
@@ -858,20 +877,26 @@
addis r11, r11, 0x0080 /* Add 8M */
mtspr SPRN_MD_RPN, r11
+ lis r8, 0x0180
+ cmplw cr0, r8, r30
+ blt 2f
+
+#ifdef CONFIG_PIN_TLB
addi r10, r10, 0x0100
mtspr SPRN_MD_CTR, r10
+#endif
addis r8, r8, 0x0080 /* Add 8M */
mtspr SPRN_MD_EPN, r8
mtspr SPRN_MD_TWC, r9
addis r11, r11, 0x0080 /* Add 8M */
mtspr SPRN_MD_RPN, r11
-#endif
/* Since the cache is enabled according to the information we
* just loaded into the TLB, invalidate and enable the caches here.
* We should probably check/set other modes....later.
*/
+2:
lis r8, IDC_INVALL@h
mtspr SPRN_IC_CST, r8
mtspr SPRN_DC_CST, r8
Index: linux/arch/powerpc/kernel/prom.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- linux/arch/powerpc/kernel/prom.c (revision 5484)
+++ linux/arch/powerpc/kernel/prom.c (copie de travail)
@@ -649,7 +649,7 @@
}
}
-void __init early_init_devtree(void *params)
+void __init early_init_devtree(void *params, u64 init_mem_size)
{
phys_addr_t limit;
@@ -697,7 +697,7 @@
/* make sure we've parsed cmdline for mem=3D before this */
if (memory_limit)
first_memblock_size =3D min_t(u64, first_memblock_size, memory_limit);
- setup_initial_memory_limit(memstart_addr, first_memblock_size);
+ setup_initial_memory_limit(memstart_addr, first_memblock_size, init_mem_s=
ize);
/* Reserve MEMBLOCK regions used by kernel, initrd, dt, etc... */
memblock_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START);
/* If relocatable, reserve first 32k for interrupt vectors etc. */
Index: linux/arch/powerpc/kernel/setup_32.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- linux/arch/powerpc/kernel/setup_32.c (revision 5484)
+++ linux/arch/powerpc/kernel/setup_32.c (copie de travail)
@@ -119,7 +119,7 @@
* This is called very early on the boot process, after a minimal
* MMU environment has been set up but before MMU_init is called.
*/
-notrace void __init machine_init(u64 dt_ptr)
+notrace void __init machine_init(u64 dt_ptr, u64 init_mem_size)
{
lockdep_init();
@@ -127,7 +127,7 @@
udbg_early_init();
/* Do some early initialization based on the flat device tree */
- early_init_devtree(__va(dt_ptr));
+ early_init_devtree(__va(dt_ptr), init_mem_size);
epapr_paravirt_early_init();
Index: linux/arch/powerpc/kernel/setup_64.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- linux/arch/powerpc/kernel/setup_64.c (revision 5484)
+++ linux/arch/powerpc/kernel/setup_64.c (copie de travail)
@@ -185,7 +185,7 @@
* device-tree is not accessible via normal means at this point.
*/
-void __init early_setup(unsigned long dt_ptr)
+void __init early_setup(unsigned long dt_ptr, u64 init_mem_size)
{
static __initdata struct paca_struct boot_paca;
@@ -214,7 +214,7 @@
* tree, such as retrieving the physical memory map or
* calculating/retrieving the hash table size.
*/
- early_init_devtree(__va(dt_ptr));
+ early_init_devtree(__va(dt_ptr), init_mem_size);
epapr_paravirt_early_init();
Index: linux/arch/powerpc/mm/40x_mmu.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- linux/arch/powerpc/mm/40x_mmu.c (revision 5484)
+++ linux/arch/powerpc/mm/40x_mmu.c (copie de travail)
@@ -147,7 +147,8 @@
}
void setup_initial_memory_limit(phys_addr_t first_memblock_base,
- phys_addr_t first_memblock_size)
+ phys_addr_t first_memblock_size,
+ u64 init_mem_size)
{
/* We don't currently support the first MEMBLOCK not mapping 0
* physical on those processors
Index: linux/arch/powerpc/mm/44x_mmu.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- linux/arch/powerpc/mm/44x_mmu.c (revision 5484)
+++ linux/arch/powerpc/mm/44x_mmu.c (copie de travail)
@@ -212,7 +212,8 @@
}
void setup_initial_memory_limit(phys_addr_t first_memblock_base,
- phys_addr_t first_memblock_size)
+ phys_addr_t first_memblock_size,
+ u64 init_mem_size)
{
u64 size;
Index: linux/arch/powerpc/mm/fsl_booke_mmu.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- linux/arch/powerpc/mm/fsl_booke_mmu.c (revision 5484)
+++ linux/arch/powerpc/mm/fsl_booke_mmu.c (copie de travail)
@@ -234,7 +234,8 @@
}
void setup_initial_memory_limit(phys_addr_t first_memblock_base,
- phys_addr_t first_memblock_size)
+ phys_addr_t first_memblock_size,
+ u64 init_mem_size)
{
phys_addr_t limit =3D first_memblock_base + first_memblock_size;
Index: linux/arch/powerpc/mm/hash_utils_64.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- linux/arch/powerpc/mm/hash_utils_64.c (revision 5484)
+++ linux/arch/powerpc/mm/hash_utils_64.c (copie de travail)
@@ -1416,7 +1416,8 @@
#endif /* CONFIG_DEBUG_PAGEALLOC */
void setup_initial_memory_limit(phys_addr_t first_memblock_base,
- phys_addr_t first_memblock_size)
+ phys_addr_t first_memblock_size,
+ u64 init_mem_size)
{
/* We don't currently support the first MEMBLOCK not mapping 0
* physical on those processors
Index: linux/arch/powerpc/mm/init_32.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- linux/arch/powerpc/mm/init_32.c (revision 5484)
+++ linux/arch/powerpc/mm/init_32.c (copie de travail)
@@ -206,19 +206,16 @@
#ifdef CONFIG_8xx /* No 8xx specific .c file to put that in ... */
void setup_initial_memory_limit(phys_addr_t first_memblock_base,
- phys_addr_t first_memblock_size)
+ phys_addr_t first_memblock_size,
+ u64 init_mem_size)
{
/* We don't currently support the first MEMBLOCK not mapping 0
* physical on those processors
*/
BUG_ON(first_memblock_base !=3D 0);
-#ifdef CONFIG_PIN_TLB
- /* 8xx can only access 24MB at the moment */
- memblock_set_current_limit(min_t(u64, first_memblock_size, 0x01800000));
-#else
- /* 8xx can only access 8MB at the moment */
- memblock_set_current_limit(min_t(u64, first_memblock_size, 0x00800000));
-#endif
+ if (!init_mem_size)
+ init_mem_size =3D 0x00800000;
+ memblock_set_current_limit(min_t(u64, first_memblock_size, init_mem_size)=
);
}
#endif /* CONFIG_8xx */
Index: linux/arch/powerpc/mm/ppc_mmu_32.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- linux/arch/powerpc/mm/ppc_mmu_32.c (revision 5484)
+++ linux/arch/powerpc/mm/ppc_mmu_32.c (copie de travail)
@@ -273,7 +273,8 @@
}
void setup_initial_memory_limit(phys_addr_t first_memblock_base,
- phys_addr_t first_memblock_size)
+ phys_addr_t first_memblock_size,
+ u64 init_mem_size)
{
/* We don't currently support the first MEMBLOCK not mapping 0
* physical on those processors
Index: linux/arch/powerpc/mm/tlb_nohash.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- linux/arch/powerpc/mm/tlb_nohash.c (revision 5484)
+++ linux/arch/powerpc/mm/tlb_nohash.c (copie de travail)
@@ -654,7 +654,8 @@
}
void setup_initial_memory_limit(phys_addr_t first_memblock_base,
- phys_addr_t first_memblock_size)
+ phys_addr_t first_memblock_size,
+ u64 init_mem_size)
{
/* On non-FSL Embedded 64-bit, we adjust the RMA size to match
* the bolted TLB entry. We know for now that only 1G
---
Ce courrier =C3=A9lectronique ne contient aucun virus ou logiciel malveilla=
nt parce que la protection avast! Antivirus est active.
http://www.avast.com
^ permalink raw reply
* Re: [PATCH 10/10] Kconfig: cleanup SERIO_I8042 dependencies
From: Mark Salter @ 2013-12-15 15:50 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: linux-mips, linux-ia64, linux-sh, Paul Mackerras, H. Peter Anvin,
sparclinux, Guan Xuetao, Russell King, x86, Ingo Molnar,
Fenghua Yu, Thomas Gleixner, linux-arm-kernel, Richard Henderson,
Tony Luck, linux-kernel, Ralf Baechle, Paul Mundt, linux-alpha,
linuxppc-dev, David S. Miller
In-Reply-To: <20131215103657.GB20197@core.coreip.homeip.net>
On Sun, 2013-12-15 at 02:36 -0800, Dmitry Torokhov wrote:
> On Sat, Dec 14, 2013 at 10:32:31AM -0800, H. Peter Anvin wrote:
> > On 12/14/2013 08:59 AM, Mark Salter wrote:
> > > Remove messy dependencies from SERIO_I8042 by having it depend on one
> > > Kconfig symbol (ARCH_MIGHT_HAVE_PC_SERIO) and having architectures
> > > which need it select ARCH_MIGHT_HAVE_PC_SERIO in arch/*/Kconfig.
> > > New architectures are unlikely to need SERIO_I8042, so this avoids
> > > having an ever growing list of architectures to exclude.
> How are we going to merge this? In bulk through input tree or peacemeal
> through all arches first?
>
They should all go together to eliminate the chance of bisect breakage.
Either the input tree or maybe akpm tree.
^ permalink raw reply
* RE: [PATCH v11] PPC: POWERNV: move iommu_add_device earlier
From: Varun Sethi @ 2013-12-15 18:22 UTC (permalink / raw)
To: Alexey Kardashevskiy, linuxppc-dev@lists.ozlabs.org
Cc: Bharat.Bhushan@freescale.com, Alex Graf,
linux-kernel@vger.kernel.org
In-Reply-To: <1386834869-15561-1-git-send-email-aik@ozlabs.ru>
> -----Original Message-----
> From: Linuxppc-dev [mailto:linuxppc-dev-
> bounces+varun.sethi=3Dfreescale.com@lists.ozlabs.org] On Behalf Of Alexey
> Kardashevskiy
> Sent: Thursday, December 12, 2013 1:24 PM
> To: linuxppc-dev@lists.ozlabs.org
> Cc: Alexey Kardashevskiy; Alex Graf; Bhushan Bharat-R65777; linux-
> kernel@vger.kernel.org
> Subject: [PATCH v11] PPC: POWERNV: move iommu_add_device earlier
>=20
> The current implementation of IOMMU on sPAPR does not use iommu_ops and
> therefore does not call IOMMU API's bus_set_iommu() which
> 1) sets iommu_ops for a bus
> 2) registers a bus notifier
> Instead, PCI devices are added to IOMMU groups from
> subsys_initcall_sync(tce_iommu_init) which does basically the same thing
> without using iommu_ops callbacks.
>=20
> However Freescale PAMU driver (https://lkml.org/lkml/2013/7/1/158)
> implements iommu_ops and when tce_iommu_init is called, every PCI device
> is already added to some group so there is a conflict.
>=20
> This patch does 2 things:
> 1. removes the loop in which PCI devices were added to groups and adds
> explicit iommu_add_device() calls to add devices as soon as they get the
> iommu_table pointer assigned to them.
> 2. moves a bus notifier to powernv code in order to avoid conflict with
> the notifier from Freescale driver.
>=20
> iommu_add_device() and iommu_del_device() are public now.
>=20
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
> Changes:
> v11:
> * rebased on upstream
>=20
> v10:
> * fixed linker error when IOMMU_API is not enabled
>=20
> v9:
> * removed "KVM" from the subject as it is not really a KVM patch so PPC
> mainainter (hi Ben!) can review/include it into his tree
>=20
> v8:
> * added the check for iommu_group!=3DNULL before removing device from a
> group as suggested by Wei Yang <weiyang@linux.vnet.ibm.com>
>=20
> v2:
> * added a helper - set_iommu_table_base_and_group - which does
> set_iommu_table_base() and iommu_add_device()
> ---
> arch/powerpc/include/asm/iommu.h | 26
> ++++++++++++++++++++++++
> arch/powerpc/kernel/iommu.c | 11 ++++------
> arch/powerpc/platforms/powernv/pci-ioda.c | 8 ++++----
> arch/powerpc/platforms/powernv/pci-p5ioc2.c | 2 +-
> arch/powerpc/platforms/powernv/pci.c | 31
> ++++++++++++++++++++++++++++-
> arch/powerpc/platforms/pseries/iommu.c | 8 +++++---
> 6 files changed, 70 insertions(+), 16 deletions(-)
>=20
> diff --git a/arch/powerpc/include/asm/iommu.h
> b/arch/powerpc/include/asm/iommu.h
> index c34656a..774fa27 100644
> --- a/arch/powerpc/include/asm/iommu.h
> +++ b/arch/powerpc/include/asm/iommu.h
> @@ -101,8 +101,34 @@ extern void iommu_free_table(struct iommu_table
> *tbl, const char *node_name);
> */
> extern struct iommu_table *iommu_init_table(struct iommu_table * tbl,
> int nid);
> +#ifdef CONFIG_IOMMU_API
> extern void iommu_register_group(struct iommu_table *tbl,
> int pci_domain_number, unsigned long pe_num);
> +extern int iommu_add_device(struct device *dev); extern void
> +iommu_del_device(struct device *dev); #else static inline void
> +iommu_register_group(struct iommu_table *tbl,
> + int pci_domain_number,
> + unsigned long pe_num)
> +{
> +}
> +
> +static inline int iommu_add_device(struct device *dev) {
> + return 0;
> +}
> +
> +static inline void iommu_del_device(struct device *dev) { } #endif /*
> +!CONFIG_IOMMU_API */
> +
> +static inline void set_iommu_table_base_and_group(struct device *dev,
> + void *base)
> +{
> + set_iommu_table_base(dev, base);
> + iommu_add_device(dev);
> +}
>=20
> extern int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
> struct scatterlist *sglist, int nelems, diff --git
> a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index
> 572bb5b..818a092 100644
> --- a/arch/powerpc/kernel/iommu.c
> +++ b/arch/powerpc/kernel/iommu.c
> @@ -1105,7 +1105,7 @@ void iommu_release_ownership(struct iommu_table
> *tbl) } EXPORT_SYMBOL_GPL(iommu_release_ownership);
>=20
> -static int iommu_add_device(struct device *dev)
> +int iommu_add_device(struct device *dev)
> {
> struct iommu_table *tbl;
> int ret =3D 0;
> @@ -1134,11 +1134,13 @@ static int iommu_add_device(struct device *dev)
>=20
> return ret;
> }
> +EXPORT_SYMBOL_GPL(iommu_add_device);
>=20
> -static void iommu_del_device(struct device *dev)
> +void iommu_del_device(struct device *dev)
> {
> iommu_group_remove_device(dev);
> }
> +EXPORT_SYMBOL_GPL(iommu_del_device);
>=20
> static int iommu_bus_notifier(struct notifier_block *nb,
> unsigned long action, void *data) @@ -1162,13
> +1164,8 @@ static struct notifier_block tce_iommu_bus_nb =3D {
>=20
> static int __init tce_iommu_init(void)
> {
> - struct pci_dev *pdev =3D NULL;
> -
> BUILD_BUG_ON(PAGE_SIZE < IOMMU_PAGE_SIZE);
>=20
> - for_each_pci_dev(pdev)
> - iommu_add_device(&pdev->dev);
> -
> bus_register_notifier(&pci_bus_type, &tce_iommu_bus_nb);
> return 0;
> }
> diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c
> b/arch/powerpc/platforms/powernv/pci-ioda.c
> index 2c6d173..f0e6871 100644
> --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> @@ -460,7 +460,7 @@ static void pnv_pci_ioda_dma_dev_setup(struct pnv_phb
> *phb, struct pci_dev *pdev
> return;
>=20
> pe =3D &phb->ioda.pe_array[pdn->pe_number];
> - set_iommu_table_base(&pdev->dev, &pe->tce32_table);
> + set_iommu_table_base_and_group(&pdev->dev, &pe->tce32_table);
> }
>=20
> static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, struct
> pci_bus *bus) @@ -468,7 +468,7 @@ static void
> pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, struct pci_bus *bus)
> struct pci_dev *dev;
>=20
> list_for_each_entry(dev, &bus->devices, bus_list) {
> - set_iommu_table_base(&dev->dev, &pe->tce32_table);
> + set_iommu_table_base_and_group(&dev->dev, &pe->tce32_table);
> if (dev->subordinate)
> pnv_ioda_setup_bus_dma(pe, dev->subordinate);
> }
> @@ -644,7 +644,7 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb
> *phb,
> iommu_register_group(tbl, pci_domain_nr(pe->pbus), pe->pe_number);
>=20
> if (pe->pdev)
> - set_iommu_table_base(&pe->pdev->dev, tbl);
> + set_iommu_table_base_and_group(&pe->pdev->dev, tbl);
> else
> pnv_ioda_setup_bus_dma(pe, pe->pbus);
>=20
> @@ -723,7 +723,7 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb
> *phb,
> iommu_register_group(tbl, pci_domain_nr(pe->pbus), pe->pe_number);
>=20
> if (pe->pdev)
> - set_iommu_table_base(&pe->pdev->dev, tbl);
> + set_iommu_table_base_and_group(&pe->pdev->dev, tbl);
> else
> pnv_ioda_setup_bus_dma(pe, pe->pbus);
>=20
> diff --git a/arch/powerpc/platforms/powernv/pci-p5ioc2.c
> b/arch/powerpc/platforms/powernv/pci-p5ioc2.c
> index f8b4bd8..e3807d6 100644
> --- a/arch/powerpc/platforms/powernv/pci-p5ioc2.c
> +++ b/arch/powerpc/platforms/powernv/pci-p5ioc2.c
> @@ -92,7 +92,7 @@ static void pnv_pci_p5ioc2_dma_dev_setup(struct pnv_phb
> *phb,
> pci_domain_nr(phb->hose->bus), phb->opal_id);
> }
>=20
> - set_iommu_table_base(&pdev->dev, &phb->p5ioc2.iommu_table);
> + set_iommu_table_base_and_group(&pdev->dev, &phb-
> >p5ioc2.iommu_table);
> }
>=20
> static void __init pnv_pci_init_p5ioc2_phb(struct device_node *np, u64
> hub_id, diff --git a/arch/powerpc/platforms/powernv/pci.c
> b/arch/powerpc/platforms/powernv/pci.c
> index 4eb33a9..a78abad 100644
> --- a/arch/powerpc/platforms/powernv/pci.c
> +++ b/arch/powerpc/platforms/powernv/pci.c
> @@ -536,7 +536,7 @@ static void pnv_pci_dma_fallback_setup(struct
> pci_controller *hose,
> pdn->iommu_table =3D pnv_pci_setup_bml_iommu(hose);
> if (!pdn->iommu_table)
> return;
> - set_iommu_table_base(&pdev->dev, pdn->iommu_table);
> + set_iommu_table_base_and_group(&pdev->dev, pdn->iommu_table);
> }
>=20
The iommu add device=20
> static void pnv_pci_dma_dev_setup(struct pci_dev *pdev) @@ -657,3
> +657,32 @@ void __init pnv_pci_init(void)
> ppc_md.teardown_msi_irqs =3D pnv_teardown_msi_irqs; #endif }
> +
> +static int tce_iommu_bus_notifier(struct notifier_block *nb,
> + unsigned long action, void *data)
> +{
> + struct device *dev =3D data;
> +
> + switch (action) {
> + case BUS_NOTIFY_ADD_DEVICE:
> + return iommu_add_device(dev);
> + case BUS_NOTIFY_DEL_DEVICE:
> + if (dev->iommu_group)
> + iommu_del_device(dev);
> + return 0;
> + default:
> + return 0;
> + }
> +}
> +
> +static struct notifier_block tce_iommu_bus_nb =3D {
> + .notifier_call =3D tce_iommu_bus_notifier, };
> +
> +static int __init tce_iommu_bus_notifier_init(void) {
> + bus_register_notifier(&pci_bus_type, &tce_iommu_bus_nb);
> + return 0;
> +}
> +
> +subsys_initcall_sync(tce_iommu_bus_notifier_init);
Why are bus notifiers required in your case, if you are creating iommu grou=
ps based on iommu tables? Also, how would you avoid conflict with PAMU iomm=
u group creation code if you use bus notifiers?
-Varun
^ permalink raw reply
* [PATCH] powerpc/sysdev: Fix a pci section mismatch for Book E
From: Christian Engelmayer @ 2013-12-15 18:39 UTC (permalink / raw)
To: linuxppc-dev
Moved the following functions out of the __init section:
arch/powerpc/sysdev/fsl_pci.c : fsl_add_bridge()
arch/powerpc/sysdev/indirect_pci.c : setup_indirect_pci()
Those are referenced by arch/powerpc/sysdev/fsl_pci.c : fsl_pci_probe() when
compiling for Book E support.
Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
---
arch/powerpc/sysdev/fsl_pci.c | 2 +-
arch/powerpc/sysdev/indirect_pci.c | 6 ++----
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 4dfd61d..2b66425 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -454,7 +454,7 @@ void fsl_pcibios_fixup_bus(struct pci_bus *bus)
}
}
-int __init fsl_add_bridge(struct platform_device *pdev, int is_primary)
+int fsl_add_bridge(struct platform_device *pdev, int is_primary)
{
int len;
struct pci_controller *hose;
diff --git a/arch/powerpc/sysdev/indirect_pci.c b/arch/powerpc/sysdev/indirect_pci.c
index c6c8b52..f434995 100644
--- a/arch/powerpc/sysdev/indirect_pci.c
+++ b/arch/powerpc/sysdev/indirect_pci.c
@@ -152,10 +152,8 @@ static struct pci_ops indirect_pci_ops =
.write = indirect_write_config,
};
-void __init
-setup_indirect_pci(struct pci_controller* hose,
- resource_size_t cfg_addr,
- resource_size_t cfg_data, u32 flags)
+void setup_indirect_pci(struct pci_controller *hose, resource_size_t cfg_addr,
+ resource_size_t cfg_data, u32 flags)
{
resource_size_t base = cfg_addr & PAGE_MASK;
void __iomem *mbase;
--
1.8.3.2
^ permalink raw reply related
* [PATCH] powerpc/sysdev: Fix a mpic section mismatch for MPC85xx
From: Christian Engelmayer @ 2013-12-15 18:38 UTC (permalink / raw)
To: linuxppc-dev
Moved arch/powerpc/sysdev/mpic.c : smp_mpic_probe() out of the __init section.
It is referenced by arch/powerpc/platforms/85xx/smp.c : smp_85xx_setup_cpu().
Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
---
arch/powerpc/sysdev/mpic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 0e166ed..72c1e65 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -1924,7 +1924,7 @@ void smp_mpic_message_pass(int cpu, int msg)
msg * MPIC_INFO(CPU_IPI_DISPATCH_STRIDE), physmask);
}
-int __init smp_mpic_probe(void)
+int smp_mpic_probe(void)
{
int nr_cpus;
--
1.8.3.2
^ permalink raw reply related
* [PATCH] powerpc: Fix endian issues in power7/8 machine check handler
From: Anton Blanchard @ 2013-12-15 23:47 UTC (permalink / raw)
To: benh, paulus; +Cc: linuxppc-dev
The SLB save area is shared with the hypervisor and is defined
as big endian, so we need to byte swap on little endian builds.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
diff --git a/arch/powerpc/kernel/mce_power.c b/arch/powerpc/kernel/mce_power.c
index b36e777..27c93f4 100644
--- a/arch/powerpc/kernel/mce_power.c
+++ b/arch/powerpc/kernel/mce_power.c
@@ -50,12 +50,12 @@ static void flush_and_reload_slb(void)
if (!slb)
return;
- n = min_t(u32, slb->persistent, SLB_MIN_SIZE);
+ n = min_t(u32, be32_to_cpu(slb->persistent), SLB_MIN_SIZE);
/* Load up the SLB entries from shadow SLB */
for (i = 0; i < n; i++) {
- unsigned long rb = slb->save_area[i].esid;
- unsigned long rs = slb->save_area[i].vsid;
+ unsigned long rb = be64_to_cpu(slb->save_area[i].esid);
+ unsigned long rs = be64_to_cpu(slb->save_area[i].vsid);
rb = (rb & ~0xFFFul) | i;
asm volatile("slbmte %0,%1" : : "r" (rs), "r" (rb));
^ permalink raw reply related
* Re: [PATCH] powerpc/sysdev: Fix a mpic section mismatch for MPC85xx
From: Benjamin Herrenschmidt @ 2013-12-16 0:10 UTC (permalink / raw)
To: Christian Engelmayer; +Cc: linuxppc-dev
In-Reply-To: <20131215193856.1637accd@spike>
On Sun, 2013-12-15 at 19:38 +0100, Christian Engelmayer wrote:
> Moved arch/powerpc/sysdev/mpic.c : smp_mpic_probe() out of the __init section.
> It is referenced by arch/powerpc/platforms/85xx/smp.c : smp_85xx_setup_cpu().
I don't like this. The reference is not actually going to call into the
code at all and as such is not an error, it's just a pointer comparison.
If there is no way to silence the warning, then I'd suggest to use a
global flag, something like mpc85xx_pic_type and test that instead
of comparing the pointers.
> Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
> ---
> arch/powerpc/sysdev/mpic.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
> index 0e166ed..72c1e65 100644
> --- a/arch/powerpc/sysdev/mpic.c
> +++ b/arch/powerpc/sysdev/mpic.c
> @@ -1924,7 +1924,7 @@ void smp_mpic_message_pass(int cpu, int msg)
> msg * MPIC_INFO(CPU_IPI_DISPATCH_STRIDE), physmask);
> }
>
> -int __init smp_mpic_probe(void)
> +int smp_mpic_probe(void)
> {
> int nr_cpus;
>
^ permalink raw reply
* [git pull] Please pull powerpc.git merge branch
From: Benjamin Herrenschmidt @ 2013-12-16 0:57 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linuxppc-dev list, Linux Kernel list
Hi Linus !
Here are some more powerpc fixes for 3.13.
Uli's patch fixes a regression in ptrace caused by a mis-merge of
a previous LE patch. The rest are all more endian fixes, all fairly
trivial, found during testing of 3.13-rc's.
Cheers,
Ben.
The following changes since commit e641eb03ab2b0f065fa5e64b4202fb5b0441b427:
powerpc: Fix up the kdump base cap to 128M (2013-12-10 11:28:39 +1100)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc.git merge
for you to fetch changes up to 803c2d2f84da9dc2619449994af34d27148ab20d:
powerpc/powernv: Fix OPAL LPC access in Little Endian (2013-12-13 15:55:15 +1100)
----------------------------------------------------------------
Anton Blanchard (8):
powerpc: Fix endian issue in setup-common.c
powerpc: Fix topology core_id endian issue on LE builds
powerpc/pseries: Fix endian issues in /proc/ppc64/lparcfg
powerpc/pseries: Fix endian issues in nvram code
powerpc/pseries: Fix PCIE link speed endian issue
powerpc/pseries: Fix endian issues in MSI code
powerpc: Fix endian issues in crash dump code
powerpc/powernv: Fix endian issue in opal_xscom_read
Benjamin Herrenschmidt (1):
powerpc/powernv: Fix OPAL LPC access in Little Endian
Ulrich Weigand (1):
powerpc: PTRACE_PEEKUSR always returns FPR0
arch/powerpc/include/asm/opal.h | 4 +--
arch/powerpc/kernel/crash_dump.c | 6 ++--
arch/powerpc/kernel/ptrace.c | 4 +--
arch/powerpc/kernel/setup-common.c | 4 +--
arch/powerpc/kernel/smp.c | 4 +--
arch/powerpc/platforms/powernv/opal-lpc.c | 12 ++++----
arch/powerpc/platforms/powernv/opal-xscom.c | 4 ++-
arch/powerpc/platforms/pseries/lparcfg.c | 12 ++++----
arch/powerpc/platforms/pseries/msi.c | 28 ++++++++++--------
arch/powerpc/platforms/pseries/nvram.c | 46 ++++++++++++++---------------
arch/powerpc/platforms/pseries/pci.c | 8 ++---
11 files changed, 68 insertions(+), 64 deletions(-)
^ permalink raw reply
* Re: [PATCH 10/10] Kconfig: cleanup SERIO_I8042 dependencies
From: David Miller @ 2013-12-16 1:27 UTC (permalink / raw)
To: msalter
Cc: linux-mips, linux-ia64, linux-sh, paulus, hpa, sparclinux, gxt,
linux, x86, mingo, fenghua.yu, tglx, linux-arm-kernel, rth,
tony.luck, dmitry.torokhov, linux-kernel, ralf, lethal,
linux-alpha, linuxppc-dev
In-Reply-To: <1387122626.1979.136.camel@deneb.redhat.com>
From: Mark Salter <msalter@redhat.com>
Date: Sun, 15 Dec 2013 10:50:26 -0500
> On Sun, 2013-12-15 at 02:36 -0800, Dmitry Torokhov wrote:
>> How are we going to merge this? In bulk through input tree or peacemeal
>> through all arches first?
>
> They should all go together to eliminate the chance of bisect breakage.
> Either the input tree or maybe akpm tree.
This sounds good to me.
^ permalink raw reply
* [PATCH] powerpc: Fix bad stack check in exception entry
From: Michael Neuling @ 2013-12-16 4:12 UTC (permalink / raw)
To: benh; +Cc: Linux PPC dev, Paul Mackerras, anton
In EXCEPTION_PROLOG_COMMON() we check to see if the stack pointer (r1)
is valid when coming from the kernel. If it's not valid, we die but
with a nice oops message.
Currently we allocate a stack frame (subtract INT_FRAME_SIZE) before we
check to see if the stack pointer is negative. Unfortunately, this
won't detect a bad stack where r1 is less than INT_FRAME_SIZE.
This patch fixes the check to compare the modified r1 with
-INT_FRAME_SIZE. With this, bad kernel stack pointers (including NULL
pointers) are correctly detected again.
Kudos to Paulus for finding this.
Signed-off-by: Michael Neuling <mikey@neuling.org>
cc: stable@vger.kernel.org
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index 894662a..243ce69 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -284,7 +284,7 @@ do_kvm_##n: \
subi r1,r1,INT_FRAME_SIZE; /* alloc frame on kernel stack */ \
beq- 1f; \
ld r1,PACAKSAVE(r13); /* kernel stack to use */ \
-1: cmpdi cr1,r1,0; /* check if r1 is in userspace */ \
+1: cmpdi cr1,r1,-INT_FRAME_SIZE; /* check if r1 is in userspace */ \
blt+ cr1,3f; /* abort if it is */ \
li r1,(n); /* will be reloaded later */ \
sth r1,PACA_TRAP_SAVE(r13); \
^ permalink raw reply related
* Re: [RFC PATCH] time: Support in tick broadcast framework for archs without an external wakeup source
From: Preeti U Murthy @ 2013-12-16 4:36 UTC (permalink / raw)
To: peterz, fweisbec, paul.gortmaker, paulus, mingo, shangw,
rafael.j.wysocki, galak, benh, paulmck, arnd, linux-pm, rostedt,
michael, john.stultz, tglx, chenhui.zhao, deepthi, r58472, geoff,
linux-kernel, srivatsa.bhat, schwidefsky, svaidy, linuxppc-dev
In-Reply-To: <20131213041901.17199.37383.stgit@preeti.in.ibm.com>
Hi,
The patch had some compile time fixes to be done. It was accidentally mailed
out before doing so. Below is the right patch. Apologies for the same.
Thanks
Regards
Preeti U Murthy
-----------------------------------------------------------------------------
time: Support in tick broadcast framework for archs without an external wakeup source
From: Preeti U Murthy <preeti@linux.vnet.ibm.com>
On some architectures, in certain CPU deep idle states the local timers stop.
An external clock device is used to wakeup these CPUs. The kernel support for the
wakeup of these CPUs is provided by the tick broadcast framework by using the
external clock device as the wakeup source.
However on architectures like PowerPC there is no external clock device. This
patch includes support in the broadcast framework to handle the wakeup of the
CPUs in deep idle states on such architectures by queuing a hrtimer on one of
the CPUs, meant to handle the wakeup of CPUs in deep idle states. This CPU is
identified as the bc_cpu.
Each time the hrtimer expires, it is reprogrammed for the next wakeup of the
CPUs in deep idle state after handling broadcast. However when a CPU is about
to enter deep idle state with its wakeup time earlier than the time at which
the hrtimer is currently programmed, it *becomes the new bc_cpu* and restarts
the hrtimer on itself. This way the job of doing broadcast is handed around to
the CPUs that ask for the earliest wakeup just before entering deep idle
state. This is consistent with what happens in cases where an external clock
device is present. The smp affinity of this clock device is set to the CPU
with the earliest wakeup.
The important point here is that the bc_cpu cannot enter deep idle state
since it has a hrtimer queued to wakeup the other CPUs in deep idle. Hence it
cannot have its local timer stopped. Therefore for such a CPU, the
BROADCAST_ENTER notification has to fail implying that it cannot enter deep
idle state. On architectures where an external clock device is present, all
CPUs can enter deep idle.
During hotplug of the bc_cpu, the job of doing a broadcast is assigned to the
first cpu in the broadcast mask. This newly nominated bc_cpu is woken up by
an IPI so as to queue the above mentioned hrtimer on itself.
This patch is compile tested only.
Signed-off-by: Preeti U Murthy <preeti@linux.vnet.ibm.com>
---
include/linux/clockchips.h | 4 +
kernel/time/clockevents.c | 8 +-
kernel/time/tick-broadcast.c | 161 +++++++++++++++++++++++++++++++++++++-----
kernel/time/tick-internal.h | 8 +-
4 files changed, 155 insertions(+), 26 deletions(-)
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 493aa02..bbda37b 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -186,9 +186,9 @@ static inline int tick_check_broadcast_expired(void) { return 0; }
#endif
#ifdef CONFIG_GENERIC_CLOCKEVENTS
-extern void clockevents_notify(unsigned long reason, void *arg);
+extern int clockevents_notify(unsigned long reason, void *arg);
#else
-static inline void clockevents_notify(unsigned long reason, void *arg) {}
+static inline int clockevents_notify(unsigned long reason, void *arg) {}
#endif
#else /* CONFIG_GENERIC_CLOCKEVENTS_BUILD */
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index 086ad60..bbbd671 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -525,11 +525,11 @@ void clockevents_resume(void)
/**
* clockevents_notify - notification about relevant events
*/
-void clockevents_notify(unsigned long reason, void *arg)
+int clockevents_notify(unsigned long reason, void *arg)
{
struct clock_event_device *dev, *tmp;
unsigned long flags;
- int cpu;
+ int cpu, ret = 0;
raw_spin_lock_irqsave(&clockevents_lock, flags);
@@ -542,11 +542,12 @@ void clockevents_notify(unsigned long reason, void *arg)
case CLOCK_EVT_NOTIFY_BROADCAST_ENTER:
case CLOCK_EVT_NOTIFY_BROADCAST_EXIT:
- tick_broadcast_oneshot_control(reason);
+ ret = tick_broadcast_oneshot_control(reason);
break;
case CLOCK_EVT_NOTIFY_CPU_DYING:
tick_handover_do_timer(arg);
+ tick_handover_bc_cpu(arg);
break;
case CLOCK_EVT_NOTIFY_SUSPEND:
@@ -585,6 +586,7 @@ void clockevents_notify(unsigned long reason, void *arg)
break;
}
raw_spin_unlock_irqrestore(&clockevents_lock, flags);
+ return ret;
}
EXPORT_SYMBOL_GPL(clockevents_notify);
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index 9532690..4ba8abb 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -20,6 +20,7 @@
#include <linux/sched.h>
#include <linux/smp.h>
#include <linux/module.h>
+#include <linux/slab.h>
#include "tick-internal.h"
@@ -35,6 +36,10 @@ static cpumask_var_t tmpmask;
static DEFINE_RAW_SPINLOCK(tick_broadcast_lock);
static int tick_broadcast_force;
+static struct hrtimer *bc_hrtimer;
+static int bc_cpu = -1;
+static ktime_t bc_next_wakeup;
+
#ifdef CONFIG_TICK_ONESHOT
static void tick_broadcast_clear_oneshot(int cpu);
#else
@@ -528,6 +533,20 @@ static int tick_broadcast_set_event(struct clock_event_device *bc, int cpu,
return ret;
}
+static void tick_broadcast_set_next_wakeup(int cpu, ktime_t expires, int force)
+{
+ struct clock_event_device *bc;
+
+ bc = tick_broadcast_device.evtdev;
+
+ if (bc) {
+ tick_broadcast_set_event(bc, cpu, expires, force);
+ } else {
+ hrtimer_start(bc_hrtimer, expires, HRTIMER_MODE_ABS_PINNED);
+ bc_cpu = cpu;
+ }
+}
+
int tick_resume_broadcast_oneshot(struct clock_event_device *bc)
{
clockevents_set_mode(bc, CLOCK_EVT_MODE_ONESHOT);
@@ -558,15 +577,13 @@ void tick_check_oneshot_broadcast(int cpu)
/*
* Handle oneshot mode broadcasting
*/
-static void tick_handle_oneshot_broadcast(struct clock_event_device *dev)
+static int tick_oneshot_broadcast(void)
{
struct tick_device *td;
ktime_t now, next_event;
int cpu, next_cpu = 0;
- raw_spin_lock(&tick_broadcast_lock);
-again:
- dev->next_event.tv64 = KTIME_MAX;
+ bc_next_wakeup.tv64 = KTIME_MAX;
next_event.tv64 = KTIME_MAX;
cpumask_clear(tmpmask);
now = ktime_get();
@@ -620,34 +637,89 @@ again:
* in the event mask
*/
if (next_event.tv64 != KTIME_MAX) {
- /*
- * Rearm the broadcast device. If event expired,
- * repeat the above
- */
- if (tick_broadcast_set_event(dev, next_cpu, next_event, 0))
+ bc_next_wakeup = next_event;
+ }
+
+ return next_cpu;
+}
+
+/*
+ * Handler in oneshot mode for the external clock device
+ */
+static void tick_handle_oneshot_broadcast(struct clock_event_device *dev)
+{
+ int next_cpu;
+
+ raw_spin_lock(&tick_broadcast_lock);
+
+again: next_cpu = tick_oneshot_broadcast();
+ /*
+ * Rearm the broadcast device. If event expired,
+ * repeat the above
+ */
+ if (bc_next_wakeup.tv64 != KTIME_MAX)
+ if (tick_broadcast_set_event(dev, next_cpu, bc_next_wakeup, 0))
goto again;
+
+ raw_spin_unlock(&tick_broadcast_lock);
+}
+
+/*
+ * Handler in oneshot mode for the hrtimer queued when there is no external
+ * clock device.
+ */
+static enum hrtimer_restart handle_broadcast(struct hrtimer *hrtmr)
+{
+ ktime_t now, interval;
+
+ raw_spin_lock(&tick_broadcast_lock);
+ tick_oneshot_broadcast();
+
+ now = ktime_get();
+
+ if (bc_next_wakeup.tv64 != KTIME_MAX) {
+ interval = ktime_sub(bc_next_wakeup, now);
+ hrtimer_forward_now(bc_hrtimer, interval);
+ raw_spin_unlock(&tick_broadcast_lock);
+ return HRTIMER_RESTART;
}
raw_spin_unlock(&tick_broadcast_lock);
+ return HRTIMER_NORESTART;
+}
+
+/* The CPU could be asked to take over from the previous bc_cpu,
+ * if it is being hotplugged out.
+ */
+static void tick_broadcast_exit_check(int cpu)
+{
+ if (cpu == bc_cpu)
+ hrtimer_start(bc_hrtimer, bc_next_wakeup,
+ HRTIMER_MODE_ABS_PINNED);
+}
+
+static int can_enter_broadcast(int cpu)
+{
+ return cpu != bc_cpu;
}
/*
* Powerstate information: The system enters/leaves a state, where
* affected devices might stop
*/
-void tick_broadcast_oneshot_control(unsigned long reason)
+int tick_broadcast_oneshot_control(unsigned long reason)
{
- struct clock_event_device *bc, *dev;
+ struct clock_event_device *dev;
struct tick_device *td;
unsigned long flags;
ktime_t now;
- int cpu;
+ int cpu, ret = 0;
/*
* Periodic mode does not care about the enter/exit of power
* states
*/
if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC)
- return;
+ return ret;
/*
* We are called with preemtion disabled from the depth of the
@@ -658,9 +730,8 @@ void tick_broadcast_oneshot_control(unsigned long reason)
dev = td->evtdev;
if (!(dev->features & CLOCK_EVT_FEAT_C3STOP))
- return;
+ return ret;
- bc = tick_broadcast_device.evtdev;
raw_spin_lock_irqsave(&tick_broadcast_lock, flags);
if (reason == CLOCK_EVT_NOTIFY_BROADCAST_ENTER) {
@@ -676,12 +747,21 @@ void tick_broadcast_oneshot_control(unsigned long reason)
* woken by the IPI right away.
*/
if (!cpumask_test_cpu(cpu, tick_broadcast_force_mask) &&
- dev->next_event.tv64 < bc->next_event.tv64)
- tick_broadcast_set_event(bc, cpu, dev->next_event, 1);
+ dev->next_event.tv64 < bc_next_wakeup.tv64)
+ bc_next_wakeup = dev->next_event;
+ tick_broadcast_set_next_wakeup(cpu, dev->next_event, 1);
+
+ if (!can_enter_broadcast(cpu)) {
+ cpumask_test_and_clear_cpu(cpu, tick_broadcast_oneshot_mask);
+ clockevents_set_mode(dev, CLOCK_EVT_MODE_ONESHOT);
+ ret = 1;
+ }
}
} else {
if (cpumask_test_and_clear_cpu(cpu, tick_broadcast_oneshot_mask)) {
clockevents_set_mode(dev, CLOCK_EVT_MODE_ONESHOT);
+
+ tick_broadcast_exit_check(cpu);
/*
* The cpu which was handling the broadcast
* timer marked this cpu in the broadcast
@@ -746,6 +826,7 @@ void tick_broadcast_oneshot_control(unsigned long reason)
}
out:
raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags);
+ return ret;
}
/*
@@ -821,18 +902,62 @@ void tick_broadcast_switch_to_oneshot(void)
{
struct clock_event_device *bc;
unsigned long flags;
+ int cpu = smp_processor_id();
raw_spin_lock_irqsave(&tick_broadcast_lock, flags);
+ bc_next_wakeup.tv64 = KTIME_MAX;
+
tick_broadcast_device.mode = TICKDEV_MODE_ONESHOT;
bc = tick_broadcast_device.evtdev;
- if (bc)
+ if (bc) {
tick_broadcast_setup_oneshot(bc);
+ bc_next_wakeup = bc->next_event;
+ } else {
+ /* An alternative to tick_broadcast_device on archs which do not have
+ * an external device
+ */
+ bc_hrtimer = kmalloc(sizeof(*bc_hrtimer), GFP_NOWAIT);
+ hrtimer_init(bc_hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED);
+ bc_hrtimer->function = handle_broadcast;
+
+ /*
+ * There may be CPUs waiting for periodic broadcast. We need
+ * to set the oneshot bits for those and program the hrtimer
+ * to fire at the next tick period.
+ */
+ cpumask_copy(tmpmask, tick_broadcast_mask);
+ cpumask_clear_cpu(cpu, tmpmask);
+ cpumask_or(tick_broadcast_oneshot_mask,
+ tick_broadcast_oneshot_mask, tmpmask);
+
+ if (!cpumask_empty(tmpmask)) {
+ tick_broadcast_init_next_event(tmpmask,
+ tick_next_period);
+ hrtimer_start(bc_hrtimer, tick_next_period, HRTIMER_MODE_ABS_PINNED);
+ bc_next_wakeup = tick_next_period;
+ }
+ }
raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags);
}
+void tick_handover_bc_cpu(int *cpup)
+{
+ struct tick_device *td;
+
+ if (*cpup == bc_cpu) {
+ int cpu = cpumask_first(tick_broadcast_oneshot_mask);
+
+ bc_cpu = (cpu < nr_cpu_ids) ? cpu : -1;
+ if (bc_cpu != -1) {
+ td = &per_cpu(tick_cpu_device, bc_cpu);
+ td->evtdev->broadcast(cpumask_of(bc_cpu));
+ }
+ }
+}
+
/*
* Remove a dead CPU from broadcasting
*/
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h
index 18e71f7..1f73032 100644
--- a/kernel/time/tick-internal.h
+++ b/kernel/time/tick-internal.h
@@ -46,23 +46,25 @@ extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *));
extern void tick_resume_oneshot(void);
# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc);
-extern void tick_broadcast_oneshot_control(unsigned long reason);
+extern int tick_broadcast_oneshot_control(unsigned long reason);
extern void tick_broadcast_switch_to_oneshot(void);
extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup);
extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc);
extern int tick_broadcast_oneshot_active(void);
extern void tick_check_oneshot_broadcast(int cpu);
+extern void tick_handover_bc_cpu(int *cpup);
bool tick_broadcast_oneshot_available(void);
# else /* BROADCAST */
static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
{
BUG();
}
-static inline void tick_broadcast_oneshot_control(unsigned long reason) { }
+static inline int tick_broadcast_oneshot_control(unsigned long reason) { }
static inline void tick_broadcast_switch_to_oneshot(void) { }
static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
static inline int tick_broadcast_oneshot_active(void) { return 0; }
static inline void tick_check_oneshot_broadcast(int cpu) { }
+static inline void tick_handover_bc_cpu(int *cpup) {}
static inline bool tick_broadcast_oneshot_available(void) { return true; }
# endif /* !BROADCAST */
@@ -87,7 +89,7 @@ static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
{
BUG();
}
-static inline void tick_broadcast_oneshot_control(unsigned long reason) { }
+static inline int tick_broadcast_oneshot_control(unsigned long reason) { }
static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc)
{
^ permalink raw reply related
* Re: [PATCH 10/10] Kconfig: cleanup SERIO_I8042 dependencies
From: Dmitry Torokhov @ 2013-12-16 4:59 UTC (permalink / raw)
To: David Miller
Cc: linux-mips, linux-ia64, linux-sh, paulus, hpa, sparclinux, gxt,
linux, x86, mingo, msalter, fenghua.yu, tglx, linux-arm-kernel,
rth, tony.luck, linux-kernel, ralf, lethal, linux-alpha,
linuxppc-dev
In-Reply-To: <20131215.202725.1549146673897801643.davem@davemloft.net>
On Sun, Dec 15, 2013 at 08:27:25PM -0500, David Miller wrote:
> From: Mark Salter <msalter@redhat.com>
> Date: Sun, 15 Dec 2013 10:50:26 -0500
>
> > On Sun, 2013-12-15 at 02:36 -0800, Dmitry Torokhov wrote:
> >> How are we going to merge this? In bulk through input tree or peacemeal
> >> through all arches first?
> >
> > They should all go together to eliminate the chance of bisect breakage.
> > Either the input tree or maybe akpm tree.
>
> This sounds good to me.
OK, then I'll pick it up once I collect more acks from the arch
maintainers.
--
Dmitry
^ 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