Re: Re: [PATCH] ACPI: Adjust the return value of _REV on x86

2015-03-23 Thread Mario Limonciello


On 03/23/2015 07:04 AM, Matt Fleming wrote:

On Mon, 16 Mar, at 04:21:51PM, Jason Ekstrand wrote:
Sadly no, Dell are not doing something useful. Their use of _REV is
entirely misguided for the same reasons using _OSI(Linux) is discouraged
in drivers/acpi/osl.c; namely that working around kernel bugs in the
BIOS is a terrible solution.

Aside from the mistake that was made in A01 ( which has been corrected for the 
recently released A02 ), the goal of this workaround is to be able to provide a 
more functional audio solution across a wider user-base.  Supporting HDA audio 
for Linux means that users from older kernels will still have a mostly working 
solution and not need to wait for the entire set of I2S kernel and userspace 
patches to land in their distro of choice.  We can't expect everyone to run the 
latest kernel just to have working audio.

The entire I2S experience is maturing (thanks Bard), but even in 4.0-rc5 there 
are still gaps.


Non-Windows BIOS code paths are not validated to the same degree as
those traversed by running Windows, which is exactly why we try so hard
to emulate Windows whenever we interact with the BIOS.

To be clear - this codepath is activating the Windows 7 audio experience even 
when Windows 8.1 is detected (Windows 2013 _OSI responds True).  It's still a 
Windows BIOS codepath and it's still heavily validated.  There are 3 values 
you'll find in a decompiled DSDT to achieve this in the _REV test block.  2 of 
them are used to provide inputs into the EC to toggle HDA or I2S mode.  The 
other modifies what ACPI audio device is presented to the system.  There isn't 
a special OS type to represent Linux here.  The selected OSTP corresponds to 
the Windows 7 OS type.

To my knowledge this is the only platform that we have so far introduced this 
HDA/I2S design.  It's also the only platform we have used _REV to change 
something for Linux specifically.  It was a calculated change.  This, among 
other things that have been found will be considered for upcoming designs.

The real way to fix this is to add the necessary support and bug fixes
to the kernel, exactly as Bard (Cc'd) has been doing.

I believe a majority of the kernel work is complete, but from some off kernel 
mailing list discussions I understand that pulseaudio doesn't understand the 
control interface that gets used for I2S for jack detection.  UCM can't be used 
for it.  This leads to a really confusing mixer design that needs a variety of 
toggles manually changed when headphones or a headset get plugged in.  There 
have also been some stability problem with audio reported after a few days 
usage.


P.S If Dell XPS13 owners try this patch and audio isn't magically
detected, make sure you perform *two* cold boots. There appears to be some
level of caching going where the last read _REV value is used.


In any case, if the _REV patch does land in the kernel, I think (we) Dell will 
still be mostly happy with the results.  Anything older than 4.x won't contain 
the the _REV patch and will run in HDA mode. If someone runs a kernel with the 
_REV patch included, it will likely have most of the more important I2S patches 
landed at the same time it runs in I2S mode.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] coresight: adding basic support for Spreadtrum SC9836

2015-03-23 Thread Chunyan Zhang
Support only for ETB, FUNNEL, STM are included currently.
Support for ETM, TPIU and the replicator linked to it are not included in
this version patch.

Signed-off-by: Chunyan Zhang 
---
 arch/arm64/boot/dts/sprd/sc9836.dtsi | 57 
 1 file changed, 57 insertions(+)

diff --git a/arch/arm64/boot/dts/sprd/sc9836.dtsi 
b/arch/arm64/boot/dts/sprd/sc9836.dtsi
index f92f1b4..2ca80f3 100644
--- a/arch/arm64/boot/dts/sprd/sc9836.dtsi
+++ b/arch/arm64/boot/dts/sprd/sc9836.dtsi
@@ -45,6 +45,63 @@
};
};
 
+   etb@10003000 {
+   compatible = "arm,coresight-etb10", "arm,primecell";
+   reg = <0 0x10003000 0 0x1000>;
+   arm,primecell-periphid = <0x0003b907>;
+   coresight-default-sink;
+   clocks = <>;
+   clock-names = "apb_pclk";
+   port {
+   etb_in: endpoint {
+   slave-mode;
+   remote-endpoint = <_out_port0>;
+   };
+   };
+   };
+
+   funnel@10001000 {
+   compatible = "arm,coresight-funnel", "arm,primecell";
+   reg = <0 0x10001000 0 0x1000>;
+   clocks = <>;
+   clock-names = "apb_pclk";
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   /* funnel output port */
+   port@0 {
+   reg = <0>;
+   funnel_out_port0: endpoint {
+   remote-endpoint = <_in>;
+   };
+   };
+
+   /* funnel input port 0~3 is reserved for ETMs */
+   port@1 {
+   reg = <4>;
+   funnel_in_port4: endpoint {
+   slave-mode;
+   remote-endpoint = <_out>;
+   };
+   };
+   };
+   };
+
+   stm@10006000 {
+   compatible = "arm,coresight-stm", "arm,primecell";
+   reg = <0 0x10006000 0 0x1000>,
+ <0 0x0100 0 0x18>;
+   reg-names = "stm-base", "stm-stimulus-base";
+   clocks = <>;
+   clock-names = "apb_pclk";
+   port {
+   stm_out: endpoint {
+   remote-endpoint = <_in_port4>;
+   };
+   };
+   };
+
gic: interrupt-controller@12001000 {
compatible = "arm,gic-400";
reg = <0 0x12001000 0 0x1000>,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] staging: unisys: handle major number properly

2015-03-23 Thread Sudip Mukherjee
On Mon, Mar 23, 2015 at 10:04:40PM +0100, Greg Kroah-Hartman wrote:
> On Tue, Mar 17, 2015 at 08:31:24PM +0530, Sudip Mukherjee wrote:

>
> This doesn't apply anymore, due to other changes recently to this
> driver.
>
> But even if it did, I don't think it is correct.  I really don't
> understand what you are trying to do here.  I think you just merged two
> different major numbers togther, which isn't good at all.  But if you
> didn't, then why is this patch doing different things to different files
> (hint, only do one thing per file.)
>
> Also, why does the driver have multiple major numbers?  Isn't a single
> major good enough?  How many does it need?  For what does it use them
> for?

but, according to my understanding the driver is having only one major
number. visorchipset_major is the major number defined in
visorchipset_main.c as a module parameter. The original code in
visorchipset_main.c was creating dev_t from this major number and
calling the function visorchipset_file_init(), which is in file.c
with the dev_t as an argument.

Now visorchipset_file_init(), it is registering that dev_t as a
char driver and  storing it in a static variable so that it can reuse
that dev_t in visorchipset_file_cleanup().

My patch is just passing the major and minor number as argument to
visorchipset_file_init() which is creating that dev_t while registering.
and instead of storing it again as a static variable i am using
Visorchipset_platform_device.dev.devt while calling the cleanup().

now since all are related to only one change so it all came in a single
patch.

is my understanding correct or am i missing something here?

regards
sudip


>
> Totally confused,
>
> greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] ocfs2: incorrect check for debugfs returns

2015-03-23 Thread Chengyu Song
debugfs_create_dir and debugfs_create_file may return -ENODEV when debugfs
is not configured, so the return value should be checked against ERROR_VALUE
as well, otherwise the later dereference of the dentry pointer would crash
the kernel.

This patch tries to solve this problem by fixing certain checks. However,
I have that found other call sites are protected by #ifdef CONFIG_DEBUG_FS.
In current implementation, if CONFIG_DEBUG_FS is defined, then the above
two functions will never return any ERROR_VALUE. So another possibility
to fix this is to surround all the buggy checks/functions with the same
#ifdef CONFIG_DEBUG_FS. But I'm not sure if this would break any functionality,
as only OCFS2_FS_STATS declares dependency on DEBUG_FS.

Signed-off-by: Chengyu Song 
---
 fs/ocfs2/cluster/heartbeat.c | 42 +++---
 fs/ocfs2/dlmglue.c   |  2 +-
 fs/ocfs2/super.c |  9 +
 3 files changed, 37 insertions(+), 16 deletions(-)

diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index 16eff45..8e19b9d 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -1312,7 +1312,9 @@ static int o2hb_debug_init(void)
int ret = -ENOMEM;
 
o2hb_debug_dir = debugfs_create_dir(O2HB_DEBUG_DIR, NULL);
-   if (!o2hb_debug_dir) {
+   if (IS_ERR_OR_NULL(o2hb_debug_dir)) {
+   ret = o2hb_debug_dir ?
+   PTR_ERR(o2hb_debug_dir) : -ENOMEM;
mlog_errno(ret);
goto bail;
}
@@ -1325,7 +1327,9 @@ static int o2hb_debug_init(void)
 sizeof(o2hb_live_node_bitmap),
 O2NM_MAX_NODES,
 o2hb_live_node_bitmap);
-   if (!o2hb_debug_livenodes) {
+   if (IS_ERR_OR_NULL(o2hb_debug_livenodes)) {
+   ret = o2hb_debug_livenodes ?
+   PTR_ERR(o2hb_debug_livenodes) : -ENOMEM;
mlog_errno(ret);
goto bail;
}
@@ -1338,7 +1342,9 @@ static int o2hb_debug_init(void)
   
sizeof(o2hb_live_region_bitmap),
   O2NM_MAX_REGIONS,
   o2hb_live_region_bitmap);
-   if (!o2hb_debug_liveregions) {
+   if (IS_ERR_OR_NULL(o2hb_debug_liveregions)) {
+   ret = o2hb_debug_liveregions ?
+   PTR_ERR(o2hb_debug_liveregions) : -ENOMEM;
mlog_errno(ret);
goto bail;
}
@@ -1352,7 +1358,9 @@ static int o2hb_debug_init(void)
  sizeof(o2hb_quorum_region_bitmap),
  O2NM_MAX_REGIONS,
  o2hb_quorum_region_bitmap);
-   if (!o2hb_debug_quorumregions) {
+   if (IS_ERR_OR_NULL(o2hb_debug_quorumregions)) {
+   ret = o2hb_debug_quorumregions ?
+   PTR_ERR(o2hb_debug_quorumregions) : -ENOMEM;
mlog_errno(ret);
goto bail;
}
@@ -1366,7 +1374,9 @@ static int o2hb_debug_init(void)
  sizeof(o2hb_failed_region_bitmap),
  O2NM_MAX_REGIONS,
  o2hb_failed_region_bitmap);
-   if (!o2hb_debug_failedregions) {
+   if (IS_ERR_OR_NULL(o2hb_debug_failedregions)) {
+   ret = o2hb_debug_failedregions ?
+   PTR_ERR(o2hb_debug_failedregions) : -ENOMEM;
mlog_errno(ret);
goto bail;
}
@@ -2000,7 +2010,8 @@ static int o2hb_debug_region_init(struct o2hb_region 
*reg, struct dentry *dir)
 
reg->hr_debug_dir =
debugfs_create_dir(config_item_name(>hr_item), dir);
-   if (!reg->hr_debug_dir) {
+   if (IS_ERR_OR_NULL(reg->hr_debug_dir)) {
+   ret = reg->hr_debug_dir ? PTR_ERR(reg->hr_debug_dir) : -ENOMEM;
mlog_errno(ret);
goto bail;
}
@@ -2013,7 +2024,9 @@ static int o2hb_debug_region_init(struct o2hb_region 
*reg, struct dentry *dir)
  O2HB_DB_TYPE_REGION_LIVENODES,
  sizeof(reg->hr_live_node_bitmap),
  O2NM_MAX_NODES, reg);
-   if (!reg->hr_debug_livenodes) {
+   if (IS_ERR_OR_NULL(reg->hr_debug_livenodes)) {
+   ret = reg->hr_debug_livenodes ?
+   PTR_ERR(reg->hr_debug_livenodes) : -ENOMEM;
mlog_errno(ret);
goto bail;
}
@@ -2025,7 +2038,9 @@ static int o2hb_debug_region_init(struct o2hb_region 
*reg, struct dentry *dir)
  sizeof(*(reg->hr_db_regnum)),

[PATCH] pci: iproc: fix PCIE_IPROC in Kconfig

2015-03-23 Thread Ray Jui
Make PCIE_IPROC depending on both OF and ARM and default to be disabled,
so it cannot be accidentally enabled by other platforms

PCIE_IPROC is meant to be enabled by a front-end bus driver. Curenntly
it's enabled by PCIE_IPROC_PLTFM driver

Signed-off-by: Ray Jui 
---
 drivers/pci/host/Kconfig |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pci/host/Kconfig b/drivers/pci/host/Kconfig
index feccd0d..963b507 100644
--- a/drivers/pci/host/Kconfig
+++ b/drivers/pci/host/Kconfig
@@ -108,6 +108,8 @@ config PCI_VERSATILE
 
 config PCIE_IPROC
tristate "Broadcom iProc PCIe controller"
+   depends on OF && ARM
+   default n
help
  This enables the iProc PCIe core controller support for Broadcom's
  iProc family of SoCs. An appropriate bus interface driver also needs
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


linux-next: manual merge of the staging tree with the v4l-dvb tree

2015-03-23 Thread Stephen Rothwell
Hi Greg,

Today's linux-next merge of the staging tree got a conflict in
drivers/staging/media/mn88473/mn88473.c between commit 3b786f131645
("[media] mn88473: calculate the IF register values") from the v4l-dvb
tree and commit b4c2c314c140 ("Staging: media: mn88473: Match alignment
with open parenthesis") from the staging tree.

I fixed it up (the former removed part of the code updated by the
latter) and can carry the fix as necessary (no action is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


pgpF_uIAiYdG6.pgp
Description: OpenPGP digital signature


Re: [PATCH 2/5] perf kmem: Analyze page allocator events also

2015-03-23 Thread Joonsoo Kim
2015-03-24 9:18 GMT+09:00 Namhyung Kim :
> On Tue, Mar 24, 2015 at 02:32:17AM +0900, Joonsoo Kim wrote:
>> 2015-03-23 15:30 GMT+09:00 Namhyung Kim :
>> > The perf kmem command records and analyze kernel memory allocation
>> > only for SLAB objects.  This patch implement a simple page allocator
>> > analyzer using kmem:mm_page_alloc and kmem:mm_page_free events.
>> >
>> > It adds two new options of --slab and --page.  The --slab option is
>> > for analyzing SLAB allocator and that's what perf kmem currently does.
>> >
>> > The new --page option enables page allocator events and analyze kernel
>> > memory usage in page unit.  Currently, 'stat --alloc' subcommand is
>> > implemented only.
>> >
>> > If none of these --slab nor --page is specified, --slab is implied.
>> >
>> >   # perf kmem stat --page --alloc --line 10
>> >
>> >   
>> > -
>> >Page | Total alloc (KB) | Hits | Order | Migration type 
>> > | GFP flags
>> >   
>> > -
>> >ea0015e48e00 |   16 |1 | 2 |RECLAIMABLE 
>> > |  00285250
>> >ea0015e47400 |   16 |1 | 2 |RECLAIMABLE 
>> > |  00285250
>> >ea001440f600 |   16 |1 | 2 |RECLAIMABLE 
>> > |  00285250
>> >ea001440cc00 |   16 |1 | 2 |RECLAIMABLE 
>> > |  00285250
>> >ea00140c6300 |   16 |1 | 2 |RECLAIMABLE 
>> > |  00285250
>> >ea00140c5c00 |   16 |1 | 2 |RECLAIMABLE 
>> > |  00285250
>> >ea00140c5000 |   16 |1 | 2 |RECLAIMABLE 
>> > |  00285250
>> >ea00140c4f00 |   16 |1 | 2 |RECLAIMABLE 
>> > |  00285250
>> >ea00140c4e00 |   16 |1 | 2 |RECLAIMABLE 
>> > |  00285250
>> >ea00140c4d00 |   16 |1 | 2 |RECLAIMABLE 
>> > |  00285250
>> >...  | ...  | ...  | ...   | ...
>> > | ...
>> >   
>> > -
>>
>> Tracepoint on mm_page_alloc print out pfn as well as pointer of struct page.
>> How about printing pfn rather than pointer of struct page?
>
> I'd really like to have pfn rather than struct page.  But I don't know
> how to convert page pointer to pfn in userspace.
>
> The output of tracepoint via $debugfs/tracing/trace file is generated
> from kernel-side, so it can easily have pfn from page pointer.  But
> tracepoint itself only saves page pointer and we need to convert/print
> it in userspace.

Ah...I didn't realize that perf don't use output of $debugfs/tracing/trace
file. So, perf just uses raw trace buffer directly? If pfn is saved to
the trace buffer, perf can print pfn rather than pointer of struct page?

> Yes, perf script (or libtraceevent) shows pfn when printing those
> events.  But that's bogus since it cannot determine the size of the
> struct page so the pointer arithmetic in open-coded page_to_pfn()
> which is saved in the print_fmt of the tracepoint will end up with an
> normal integer arithmatic.

How about following change and making 'perf kmem' print pfn?
If we store pfn on the trace buffer, we can print $debugfs/tracing/trace
as is and 'perf kmem' can also print pfn.

Thanks.

diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
index 4ad10ba..9dcfd0b 100644
--- a/include/trace/events/kmem.h
+++ b/include/trace/events/kmem.h
@@ -199,22 +199,22 @@ TRACE_EVENT(mm_page_alloc,
TP_ARGS(page, order, gfp_flags, migratetype),

TP_STRUCT__entry(
-   __field(struct page *,  page)
+   __field(unsigned long,  pfn )
__field(unsigned int,   order   )
__field(gfp_t,  gfp_flags   )
__field(int,migratetype )
),

TP_fast_assign(
-   __entry->page   = page;
+   __entry->pfn= page ? page_to_pfn(page) : -1;
__entry->order  = order;
__entry->gfp_flags  = gfp_flags;
__entry->migratetype= migratetype;
),

TP_printk("page=%p pfn=%lu order=%d migratetype=%d gfp_flags=%s",
-   __entry->page,
-   __entry->page ? page_to_pfn(__entry->page) : 0,
+   __entry->pfn != -1 ? pfn_to_page(__entry->pfn) : NULL,
+   __entry->pfn != -1 ? __entry->pfn : 0,
__entry->order,
__entry->migratetype,
show_gfp_flags(__entry->gfp_flags))
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to 

Re: [PATCH] ARM: cygnus: fix const declaration bcm_cygnus_dt_compat

2015-03-23 Thread Ray Jui


On 3/23/2015 10:18 PM, Scott Branden wrote:
> Hi Stefan,
> 
> On 15-03-21 04:45 PM, Stefan Agner wrote:
>> The const declaration for char* is actually duplicated, however
>> the array of strings is currently not constant. However, typically
>> the dt_compat array is declared as const char *const. Follow
>> that convention and also add the __initconst macro for constant
>> initialization data.
>>
> Acked-by: Scott Branden 
>> Signed-off-by: Stefan Agner 
>> ---
>> This was uncovered by a LLVM/clang warning:
>> arch/arm/mach-bcm/bcm_cygnus.c:16:19: warning: duplicate 'const'
>> declaration
>> specifier [-Wduplicate-decl-specifier]
>> static const char const *bcm_cygnus_dt_compat[] = {
>>^~
>> 1 warning generated.
>>
>>   arch/arm/mach-bcm/bcm_cygnus.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/mach-bcm/bcm_cygnus.c
>> b/arch/arm/mach-bcm/bcm_cygnus.c
>> index 30dc58b..7ae894c 100644
>> --- a/arch/arm/mach-bcm/bcm_cygnus.c
>> +++ b/arch/arm/mach-bcm/bcm_cygnus.c
>> @@ -13,7 +13,7 @@
>>
>>   #include 
>>
>> -static const char const *bcm_cygnus_dt_compat[] = {
>> +static const char * const bcm_cygnus_dt_compat[] __initconst = {
>>   "brcm,cygnus",
>>   NULL,
>>   };
>>
> Thanks for submitting.  We will test this.
> 
> Scott

Change looks fine and tested fine on Cygnus BCM958300k board. Thanks!

Reviewed-by: Ray Jui 
Tested-by: Ray Jui 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/5] Driver for pxa architectures

2015-03-23 Thread Arnd Bergmann
On Monday 23 March 2015, Robert Jarzmik wrote:
> Arnd Bergmann  writes:
> 
> ... removed people not concerned by pxa story ...
> 
> >> As for XIP support, I don't have a clear view if it's a requirement for
> >> multiplatform nor if it works in these builds.
> >
> > It would be nice to not have to support both options: if we put pxa into
> > ARCH_MULTIPLATFORM, I'd like to remove the existing entry from the choice
> > statement at the same time.
> Ah I wasn't aware of that ... that will deserve some thought from me ...

It's not 100% required, but it's what we ended up doing on all other
platforms.

> >> > I think all of them are theoretically doable, but I wasn't expecting
> >> > to ever get there.
> >> Well, that makes me a goal to reach, doesn't it ? I'll stick to optimism 
> >> here,
> >> and we'll see within a year how far I manage to go :)
> >
> > Fair enough. Any work you do on this is highly appreciated anyway,
> > regardless of whether you complete it or not. BTW, one thought I had
> > a while ago was that we can move support for any PXA machines that are
> > DT enabled into mach-mmp, which hopefully will be fully DT-only and
> > multiplatform enabled at some point, and we can keep mach-pxa for the
> > legacy board files if you don't succeed in converting them all.
> 
> Actually, this deserves another discussion alltogether. My plan was not to
> convert all pxa board files to dt support, but all internal SoC IPs drivers +
> mach/plat support.
> 
> Or put another way at the end :
>  - there will be at least one pxa25x board which is fully DT converted
>  - there will be at least one pxa27x board which is fully DT converted
>  - there will be at least one pxa3xx board which is fully DT converted
> 
>  - there will be at least one pxa25x board which is not DT converted
>  - there will be at least one pxa27x board which is not DT converted
>  - there will be at least one pxa3xx board which is not DT converted
> 
> I want to keep the support for both legacy platform_data and DT for pxa
> architecture. The idea I had was that only fully DT converted machines will
> benefit from multiplatform support.

I see. On other platforms, we also have board files that are not DT
but are included in multiplatform. I don't see anything wrong in general.

The more important question is whether you want to keep having a single
kernel capable of running on all PXA machines (DT and ATAGS), while also
doing a subset of PXA that can be multiplatform with other ARMv5 targets
like pxa168 (MMP) but excluding the rest of PXA.

> As for mach-mmp, I don't see how this could work, as there are architecture
> specific parts that will probably remain, such as the suspend to RAM code
> (arch/arm/mach-pxa/sleep.S). This might be doable, even if I don't see how.

Those parts could be moved to plat-pxa.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ARM: cygnus: fix const declaration bcm_cygnus_dt_compat

2015-03-23 Thread Scott Branden

Hi Stefan,

On 15-03-21 04:45 PM, Stefan Agner wrote:

The const declaration for char* is actually duplicated, however
the array of strings is currently not constant. However, typically
the dt_compat array is declared as const char *const. Follow
that convention and also add the __initconst macro for constant
initialization data.


Acked-by: Scott Branden 

Signed-off-by: Stefan Agner 
---
This was uncovered by a LLVM/clang warning:
arch/arm/mach-bcm/bcm_cygnus.c:16:19: warning: duplicate 'const' declaration
specifier [-Wduplicate-decl-specifier]
static const char const *bcm_cygnus_dt_compat[] = {
   ^~
1 warning generated.

  arch/arm/mach-bcm/bcm_cygnus.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-bcm/bcm_cygnus.c b/arch/arm/mach-bcm/bcm_cygnus.c
index 30dc58b..7ae894c 100644
--- a/arch/arm/mach-bcm/bcm_cygnus.c
+++ b/arch/arm/mach-bcm/bcm_cygnus.c
@@ -13,7 +13,7 @@

  #include 

-static const char const *bcm_cygnus_dt_compat[] = {
+static const char * const bcm_cygnus_dt_compat[] __initconst = {
"brcm,cygnus",
NULL,
  };


Thanks for submitting.  We will test this.

Scott
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] f2fs: limit b_size of mapped bh in f2fs_map_bh

2015-03-23 Thread Chao Yu
Map bh over max size which caller defined is not needed, limit it in
f2fs_map_bh.

Signed-off-by: Chao Yu 
---
v2 change log:
 - use min() for cleanup code suggested by Jaegeuk Kim.

 fs/f2fs/data.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index f0a18a0..279c9c6e 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -255,15 +255,13 @@ static void f2fs_map_bh(struct super_block *sb, pgoff_t 
pgofs,
struct extent_info *ei, struct buffer_head *bh_result)
 {
unsigned int blkbits = sb->s_blocksize_bits;
-   size_t count;
+   size_t max_size = bh_result->b_size;
+   size_t mapped_size;
 
clear_buffer_new(bh_result);
map_bh(bh_result, sb, ei->blk + pgofs - ei->fofs);
-   count = ei->fofs + ei->len - pgofs;
-   if (count < (UINT_MAX >> blkbits))
-   bh_result->b_size = (count << blkbits);
-   else
-   bh_result->b_size = UINT_MAX;
+   mapped_size = (ei->fofs + ei->len - pgofs) << blkbits;
+   bh_result->b_size = min(max_size, mapped_size);
 }
 
 static bool lookup_extent_info(struct inode *inode, pgoff_t pgofs,
-- 
2.3.3


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH 1/4] f2fs: limit b_size of mapped bh in f2fs_map_bh

2015-03-23 Thread Chao Yu
Hi Jaegeuk,

> -Original Message-
> From: Jaegeuk Kim [mailto:jaeg...@kernel.org]
> Sent: Tuesday, March 24, 2015 12:42 PM
> To: Chao Yu
> Cc: Changman Lee; linux-f2fs-de...@lists.sourceforge.net; 
> linux-kernel@vger.kernel.org
> Subject: Re: [PATCH 1/4] f2fs: limit b_size of mapped bh in f2fs_map_bh
> 
> Hi Chao,
> 
> On Mon, Mar 23, 2015 at 10:28:00AM +0800, Chao Yu wrote:
> > Map bh over max size which caller defined is not needed, limit it in
> > f2fs_map_bh.
> >
> > Signed-off-by: Chao Yu 
> > ---
> >  fs/f2fs/data.c | 7 ---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> > index f0a18a0..a99bc7f 100644
> > --- a/fs/f2fs/data.c
> > +++ b/fs/f2fs/data.c
> > @@ -255,15 +255,16 @@ static void f2fs_map_bh(struct super_block *sb, 
> > pgoff_t pgofs,
> > struct extent_info *ei, struct buffer_head *bh_result)
> >  {
> > unsigned int blkbits = sb->s_blocksize_bits;
> > +   unsigned int maxblocks = bh_result->b_size >> blkbits;
> > size_t count;
> >
> > clear_buffer_new(bh_result);
> > map_bh(bh_result, sb, ei->blk + pgofs - ei->fofs);
> > count = ei->fofs + ei->len - pgofs;
> > -   if (count < (UINT_MAX >> blkbits))
> > -   bh_result->b_size = (count << blkbits);
> > +   if (count > maxblocks)
> > +   bh_result->b_size = maxblocks << blkbits;
> > else
> > -   bh_result->b_size = UINT_MAX;
> > +   bh_result->b_size = count << blkbits;
> 
> How about using min()?

Better, I will do it. :)

Thanks,

> 
> Thanks,
> 
> >  }
> >
> >  static bool lookup_extent_info(struct inode *inode, pgoff_t pgofs,
> > --
> > 2.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: sm750fb: Fixed C99 comments warnings

2015-03-23 Thread Ragavendra Nagraj
This patch fixes the C99-style "// ..." comments warnings identified by the
checkpath.pl script for the entire ddk750_chip.c file by using the
appropriate C89 "/* ... */" style comments accordingly.

Signed-off-by: Ragavendra Nagraj 
---
 drivers/staging/sm750fb/ddk750_chip.c |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_chip.c 
b/drivers/staging/sm750fb/ddk750_chip.c
index 02f9326..1fb00a4 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -17,7 +17,7 @@ logical_chip_type_t getChipType(void)
char physicalRev;
logical_chip_type_t chip;
 
-   physicalID = devId750;//either 0x718 or 0x750
+   physicalID = devId750;/*either 0x718 or 0x750*/
physicalRev = revId750;
 
if (physicalID == 0x718)
@@ -264,7 +264,7 @@ int ddk750_initHw(initchip_param_t * pInitParam)
 
unsigned int ulReg;
 #if 0
-   //move the code to map regiter function.
+   /*move the code to map regiter function.*/
if(getChipType() == SM718){
/* turn on big endian bit*/
ulReg = PEEK32(0x74);
@@ -501,7 +501,7 @@ unsigned int calcPllValue(unsigned int 
request_orig,pll_value_t *pll)
}
}
 
-   //printk("Finally:  
pll->n[%lu],m[%lu],od[%lu],pod[%lu]\n",pll->N,pll->M,pll->OD,pll->POD);
+   /*printk("Finally:  
pll->n[%lu],m[%lu],od[%lu],pod[%lu]\n",pll->N,pll->M,pll->OD,pll->POD);*/
return ret;
 }
 
@@ -597,13 +597,13 @@ pll_value_t *pPLL   /* Structure to hold the 
value to be set in PLL */
}
 
 /* Restore input frequency from Khz to hz unit */
-//pPLL->inputFreq *= 1000;
+/*pPLL->inputFreq *= 1000;*/
ulRequestClk *= 1000;
pPLL->inputFreq = DEFAULT_INPUT_CLOCK; /* Default reference clock */
 
 /* Output debug information */
-   //DDKDEBUGPRINT((DISPLAY_LEVEL, "calcPllValue: Requested Frequency = 
%d\n", ulRequestClk));
-   //DDKDEBUGPRINT((DISPLAY_LEVEL, "calcPllValue: Input CLK = %dHz, M=%d, 
N=%d, OD=%d, POD=%d\n", pPLL->inputFreq, pPLL->M, pPLL->N, pPLL->OD, 
pPLL->POD));
+   /*DDKDEBUGPRINT((DISPLAY_LEVEL, "calcPllValue: Requested Frequency = 
%d\n", ulRequestClk));*/
+   /*DDKDEBUGPRINT((DISPLAY_LEVEL, "calcPllValue: Input CLK = %dHz, M=%d, 
N=%d, OD=%d, POD=%d\n", pPLL->inputFreq, pPLL->M, pPLL->N, pPLL->OD, 
pPLL->POD));*/
 
 /* Return actual frequency that the PLL can set */
ret = calcPLL(pPLL);
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] staging: sm7xxfb: add MODULE_DEVICE_TABLE

2015-03-23 Thread Sudip Mukherjee
add MODULE_DEVICE_TABLE to support hot-plugging.

Signed-off-by: Sudip Mukherjee 
---
 drivers/staging/sm7xxfb/sm7xxfb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c 
b/drivers/staging/sm7xxfb/sm7xxfb.c
index 6e9b2aa..15509a6 100644
--- a/drivers/staging/sm7xxfb/sm7xxfb.c
+++ b/drivers/staging/sm7xxfb/sm7xxfb.c
@@ -922,6 +922,8 @@ static const struct pci_device_id smtcfb_pci_table[] = {
{0,}
 };
 
+MODULE_DEVICE_TABLE(pci, smtcfb_pci_table);
+
 static void smtcfb_pci_remove(struct pci_dev *pdev)
 {
struct smtcfb_info *sfb;
-- 
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] staging: sm7xxfb: start using module parameters

2015-03-23 Thread Sudip Mukherjee
add module parameters so that we can configure X and Y resolutions
and bpp when using this driver as a module.

Signed-off-by: Sudip Mukherjee 
---
 drivers/staging/sm7xxfb/sm7xxfb.c | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c 
b/drivers/staging/sm7xxfb/sm7xxfb.c
index abdb021..6e9b2aa 100644
--- a/drivers/staging/sm7xxfb/sm7xxfb.c
+++ b/drivers/staging/sm7xxfb/sm7xxfb.c
@@ -1033,6 +1033,24 @@ static int __init sm712fb_init(void)
 
 module_init(sm712fb_init);
 
+module_param(mode_option, charp, S_IRUGO);
+
+MODULE_PARM_DESC(mode_option, "\n\t\tOptions:\n"
+"\t\t0x301 = 640x480-8\n"
+"\t\t0x303 = 800x600-8\n"
+"\t\t0x305 = 1024x768-8\n"
+"\t\t0x307 = 1280x1024-8\n"
+"\t\t0x311 = 640x480-16\n"
+"\t\t0x314 = 800x600-16\n"
+"\t\t0x317 = 1024x768-16\n"
+"\t\t0x31A = 1280x1024-16\n"
+"\t\t0x312 = 640x480-24\n"
+"\t\t0x315 = 800x600-24\n"
+"\t\t0x318 = 1024x768-24\n"
+"\t\t0x31B = 1280x1024-24\n"
+"\t\tUsual example:\n"
+"\t\tinsmod ./sm7xxfb.ko mode_option=\"0x301\"\n");
+
 static void __exit sm712fb_exit(void)
 {
pci_unregister_driver(_driver);
-- 
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: panel: fix lcd type

2015-03-23 Thread Sudip Mukherjee
the lcd type as defined in the Kconfig is not matching in the code.
as a result the rs, rw and en pins were getting interchanged.
Kconfig defines the value of PANEL_LCD to be 1 if we select custom
configuration but in the code LCD_TYPE_CUSTOM is defined as 5.

my hardware is LCD_TYPE_CUSTOM, but the pins were assigned to it
as pins of LCD_TYPE_OLD, and it was not working.
Now values are corrected with referenece to the values defined in
Kconfig and it is working.
checked on JHD204A lcd with LCD_TYPE_CUSTOM configuration.

Signed-off-by: Sudip Mukherjee 
---

I traced the code till 2.6.32.2 and it was same problem in lcd_init(),
it can work only if we have configured for custom lcd type with
connections similar to the connections of LCD_TYPE_OLD.

 drivers/staging/panel/panel.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index 16fee49..42e 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -314,11 +314,11 @@ static unsigned char 
lcd_bits[LCD_PORTS][LCD_BITS][BIT_STATES];
  * LCD types
  */
 #define LCD_TYPE_NONE  0
-#define LCD_TYPE_OLD   1
-#define LCD_TYPE_KS00742
-#define LCD_TYPE_HANTRONIX 3
-#define LCD_TYPE_NEXCOM4
-#define LCD_TYPE_CUSTOM5
+#define LCD_TYPE_CUSTOM1
+#define LCD_TYPE_OLD   2
+#define LCD_TYPE_KS00743
+#define LCD_TYPE_HANTRONIX 4
+#define LCD_TYPE_NEXCOM5
 
 /*
  * keypad types
-- 
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 3/4] drm/msm/mdp5: Add START signal to kick off certain pipelines

2015-03-23 Thread Archit Taneja



On 03/24/2015 03:40 AM, "Stéphane Viau" wrote:

Hi Archit,


Hi Stephane,

On 03/14/2015 01:19 AM, Stephane Viau wrote:

Some interfaces (WB, DSI Command Mode) need to be kicked off
through a START Signal. This signal needs to be sent at the right
time and requests in some cases to keep track of the pipeline
status (eg: whether pipeline registers are flushed AND output WB
buffers are ready, in case of WB interface).

Signed-off-by: Stephane Viau 
---
   drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c |   2 +
   drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h |   7 +-
   drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c|  31 ++--
   drivers/gpu/drm/msm/mdp/mdp5/mdp5_ctl.c | 247

   drivers/gpu/drm/msm/mdp/mdp5/mdp5_ctl.h |  72 +++-
   drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c |  13 +-
   drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h |   1 +
   7 files changed, 276 insertions(+), 97 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
index c078f30..72c075a 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
@@ -31,6 +31,7 @@ const struct mdp5_cfg_hw msm8x74_config = {
.ctl = {
.count = 5,
.base = { 0x00600, 0x00700, 0x00800, 0x00900, 0x00a00 },
+   .flush_hw_mask = 0x0003,
},
.pipe_vig = {
.count = 3,
@@ -78,6 +79,7 @@ const struct mdp5_cfg_hw apq8084_config = {
.ctl = {
.count = 5,
.base = { 0x00600, 0x00700, 0x00800, 0x00900, 0x00a00 },
+   .flush_hw_mask = 0x003f,


msm8x16 would require a flush_hw_mask too, it should be 0x32a59 if I'm
not wrong. Could you please add it for the next revision, or as a part
of the 8x16 hw cfg patch?


Correct; thanks for pointing this out.

IMO, this value should be 0x4003 because the fields are actually
present in the register (even though the interfaces/pipes.etc. are not).
Anyway, these bits won't be accessed because the driver won't even allow
the usage of the corresponding resources.



Okay, that makes sense.



I will update in the v2 of "drm/msm/mdp5: Add hardware configuration for
msm8x16".

Thanks,
Stephane.



Thanks!
Archit

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/1] cifs: potential memory leaks when parsing mnt opts

2015-03-23 Thread Steve French
Nice catch.

Merged into cifs-2.6.git for-next

On Sat, Mar 21, 2015 at 6:08 PM, Taesoo Kim  wrote:
> For example, when mount opt is redundently specified
> (e.g., "user=A,user=B,user=C"), kernel kept allocating new key/val
> with kstrdup() and overwrite previous ptr (to be freed).
>
> Althouhg mkfs.cifs in userspace performs a bit of sanitization
> (e.g., forcing one user option), current implementation is not
> robust. Other options such as iocharset and domainanme are similary
> vulnerable.
>
> Signed-off-by: Taesoo Kim 
> ---
>  fs/cifs/connect.c | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index d3aa999..4cb8450 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -1599,6 +1599,8 @@ cifs_parse_mount_options(const char *mountdata, const 
> char *devname,
> pr_warn("CIFS: username too long\n");
> goto cifs_parse_mount_err;
> }
> +
> +   kfree(vol->username);
> vol->username = kstrdup(string, GFP_KERNEL);
> if (!vol->username)
> goto cifs_parse_mount_err;
> @@ -1700,6 +1702,7 @@ cifs_parse_mount_options(const char *mountdata, const 
> char *devname,
> goto cifs_parse_mount_err;
> }
>
> +   kfree(vol->domainname);
> vol->domainname = kstrdup(string, GFP_KERNEL);
> if (!vol->domainname) {
> pr_warn("CIFS: no memory for domainname\n");
> @@ -1731,6 +1734,7 @@ cifs_parse_mount_options(const char *mountdata, const 
> char *devname,
> }
>
>  if (strncasecmp(string, "default", 7) != 0) {
> +   kfree(vol->iocharset);
> vol->iocharset = kstrdup(string,
>  GFP_KERNEL);
> if (!vol->iocharset) {
> --
> 2.3.3
>



-- 
Thanks,

Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] f2fs: limit b_size of mapped bh in f2fs_map_bh

2015-03-23 Thread Jaegeuk Kim
Hi Chao,

On Mon, Mar 23, 2015 at 10:28:00AM +0800, Chao Yu wrote:
> Map bh over max size which caller defined is not needed, limit it in
> f2fs_map_bh.
> 
> Signed-off-by: Chao Yu 
> ---
>  fs/f2fs/data.c | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index f0a18a0..a99bc7f 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -255,15 +255,16 @@ static void f2fs_map_bh(struct super_block *sb, pgoff_t 
> pgofs,
>   struct extent_info *ei, struct buffer_head *bh_result)
>  {
>   unsigned int blkbits = sb->s_blocksize_bits;
> + unsigned int maxblocks = bh_result->b_size >> blkbits;
>   size_t count;
>  
>   clear_buffer_new(bh_result);
>   map_bh(bh_result, sb, ei->blk + pgofs - ei->fofs);
>   count = ei->fofs + ei->len - pgofs;
> - if (count < (UINT_MAX >> blkbits))
> - bh_result->b_size = (count << blkbits);
> + if (count > maxblocks)
> + bh_result->b_size = maxblocks << blkbits;
>   else
> - bh_result->b_size = UINT_MAX;
> + bh_result->b_size = count << blkbits;

How about using min()?

Thanks,

>  }
>  
>  static bool lookup_extent_info(struct inode *inode, pgoff_t pgofs,
> -- 
> 2.3.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [V4.0-rc5 Regression] drm/intel problem

2015-03-23 Thread Dave Airlie


> The display remains dark in V4.0-rc5 except of a small white line
> at the top of the screen so I can't see anything. RC4 was good.
> The latest good kernel that I know of is at least
> 4.0.0-rc4-00199-gb314aca.

I'm hoping the fix I just sent Linus is the fix for this, otherwise Daniel 
and co will look into it.

Dave.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] kernel/panic/kexec: fix "crash_kexec_post_notifiers" option issue in oops path

2015-03-23 Thread Masami Hiramatsu
(2015/03/23 23:31), Vivek Goyal wrote:
[...]
 Secondly, and more importantly, the whole premise of commit 
 f06e5153f4ae is broken IMHO:

  "This can help rare situations where kdump fails because of unstable
   crashed kernel or hardware failure (memory corruption on critical
   data/code)"

 wtf?

 If the kernel crashed due to a kernel crash, then the kernel booting 
 up in whatever hardware state should be able to do a clean bootup. The 
 fix for those 'rare situations' should be to fix the real bug (for 
 example by making hardware driver init (or deinit) sequences more 
 robust), not to paper it over by ordering around crash-time sequences 
 ...

 If it crashed due to some hardware failure, there's literally an 
 infinite amount of failure modes that may or may not be impacted by 
 kexec crash-time handling ordering. We don't want to put a zillion 
 such flags into the kernel proper just to allow the perturbation of 
 the kernel.
>>>
>>> I think one of the motivations behind this patch was call to kmsg_dump().
>>> Some vendors have been wanting to have the capability to save kernel logs
>>> to some NVRAM before transition to second kernel happens. Their argument
>>> is that kdump does not succeed all the time and if kdump does not succeed
>>> then atleast they have something to work with (kernel logs retrieved
>>> from pstore interface).
>>
>> Doesn't pstore attach itself to printk itself? AFAICS it does:
>>
>>  fs/pstore/platform.c:   register_console(_console);
>>
>> so the printk log leading up to and including the crash should be 
>> available, regardless of this patch. What am I missing?
> 
> That's a good point. I was not aware of it. I am Ccing Don Zickus as
> he has spent some time on this in the past.
> 
> Masami, would you have thougths on this? IIRC, one reason why kmsg_dump()
> was written so that one could dump kernel messages to an NVRAM. Of one
> could simple register pstore as console, then how kmsg_dump() will
> continue to be useful?

Yes, actually, kmsg_dump and pstore can help a lot to dump the last
message (even though kmsg_dump() is called only when setting
crash_kexec_post_notifiers...)

However, there are some machines which don't support pstore, but
only IPMI. pstore(kmsg) stores messages to a local NVRAM, and IPMI
stores messages to BMC(Board Management Controller)'s NVRAM (SEL:
System Event Log).
Some enterprise servers only have BMC, but no NVRAM. For such kind
of servers, we still need to call panic_notifier to store messages
via IPMI.
And also, using IPMI has another secondary feature, we can notice
machine failure from remote machine via IPMI over LAN by monitoring
SEL :)

You might want to integrate IPMI and pstore. But since IPMI SEL is
very limited and very slow, those are very different.

>>> Not that I agree fully with this as problem might happen while we 
>>> try to run panic_notifiers or kmsg_dump hooks and never transition 
>>> into kdump kernel.
>>
>> btw., this is the big problem with 'notifiers' in general: they are 
>> opaque with barely any semantics defined, and a source of constant 
>> confusion.
> 
> Agreed. That's the reason Eric never liked the idea of letting panic
> notifiers run before crash_kexec().

I see. thus I added a notice on documentation.

Note that this also increases risks of kdump failure,
because some panic notifiers can make the crashed
kernel more unstable.

I personally don't recommend to use this in usual situation. Only for
the machines which is very well configured and tested, this feature can
be enabled.

>>> And it has been literally years since some developers have been 
>>> pushing for allowing to run panic notifiers before crash_kexec(). 
>>> Eric Biederman has been pushing back saying it reduces the 
>>> reliability of kdump operation so this is not acceptable.
>>
>> So what do those notifiers do?
> 
> IIRC, two main reasons had come in the past.
> 
> - In a cluster of nodes, people wanted to send some sort of notifications
>   to main server that a node has crashed and don't fence it off as it
>   might be saving dump.
> 
> - And saving kernel logs to non volatile store.
> 
> There might be more and I might not be aware about these. Hatayama and
> Masami, can you shed more light on this.

Yes, as I described above, we'd like to use IPMI to write the log to SEL
and that also allow us to monitor the machine remotely.

> 
> BTW, first problem we faced in our clusters too and now it has been fixed.
> Basically we send notifications in second kernel in user space to master
> server that this node is still saving dump so don't fence it off.

Yeah, that's the usual way, I think. In some "mission-critical" use-cases,
we can't relay only on the kdump stability.

Thank you,



-- 
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., 

[PATCH v8 27/30] PCI: Rename __pci_create_root_bus() to pci_create_root_bus()

2015-03-23 Thread Yijing Wang
Now no one use pci_create_root_bus(), we could remove it
and rename __pci_create_root_bus() to pci_create_root_bus().

Signed-off-by: wangyij...@huawei.com
---
 drivers/pci/probe.c |   35 +--
 include/linux/pci.h |3 ---
 2 files changed, 9 insertions(+), 29 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 7796bf8..cb0237f 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1852,7 +1852,7 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 {
 }
 
-static struct pci_bus *__pci_create_root_bus(
+static struct pci_bus *pci_create_root_bus(
struct pci_host_bridge *bridge, struct pci_ops *ops)
 {
int error;
@@ -1937,24 +1937,6 @@ put_dev:
return NULL;
 }
 
-struct pci_bus *pci_create_root_bus(struct device *parent,
-   int domain, int bus, struct pci_ops *ops, void *sysdata,
-   struct list_head *resources)
-{
-   struct pci_host_bridge *host;
-
-   host = pci_create_host_bridge(parent, domain, bus,
-   sysdata, resources, NULL);
-   if (!host)
-   return NULL;
-
-   host->bus = __pci_create_root_bus(host, ops);
-   if (!host->bus)
-   pci_free_host_bridge(host);
-
-   return host->bus;
-}
-
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max)
 {
struct resource *res = >busn_res;
@@ -2030,7 +2012,7 @@ static struct pci_bus *__pci_scan_root_bus(
struct pci_bus *b;
int max;
 
-   b = __pci_create_root_bus(host, ops);
+   b = pci_create_root_bus(host, ops);
if (!b)
return NULL;
 
@@ -2093,19 +2075,20 @@ struct pci_bus *pci_scan_bus(int domain, int bus,
struct pci_ops *ops, void *sysdata)
 {
LIST_HEAD(resources);
-   struct pci_bus *b;
+   struct pci_host_bridge *host;
 
pci_add_resource(, _resource);
pci_add_resource(, _resource);
pci_add_resource(, _resource);
-   b = pci_create_root_bus(NULL, domain, bus, ops, sysdata,
-   );
-   if (b) {
-   pci_scan_child_bus(b);
+   host = pci_create_host_bridge(NULL, domain, bus, sysdata,
+   , NULL);
+   if (host) {
+   __pci_scan_root_bus(host, ops);
+   return host->bus;
} else {
pci_free_resource_list();
}
-   return b;
+   return NULL;
 }
 EXPORT_SYMBOL(pci_scan_bus);
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 61e0853..62333ff 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -782,9 +782,6 @@ struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
 struct pci_bus *pci_scan_bus(int domain, int bus, struct pci_ops *ops,
void *sysdata);
-struct pci_bus *pci_create_root_bus(struct device *parent, int domain, int bus,
-   struct pci_ops *ops, void *sysdata,
-   struct list_head *resources);
 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax);
 int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax);
 void pci_bus_release_busn_res(struct pci_bus *b);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 04/30] PCI: Move pci_bus_assign_domain_nr() declaration into drivers/pci/pci.h

2015-03-23 Thread Yijing Wang
pci_bus_assign_domain_nr() is only called in probe.c,
Move pci_bus_assign_domain_nr() declaration into
drivers/pci/pci.h.

Signed-off-by: Yijing Wang 
---
 drivers/pci/pci.h   |9 +
 include/linux/pci.h |6 --
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 4091f82..ba1bcce 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -321,4 +321,13 @@ static inline int pci_dev_specific_reset(struct pci_dev 
*dev, int probe)
 }
 #endif
 
+#ifdef CONFIG_PCI_DOMAINS_GENERIC
+void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent);
+#else
+static inline void pci_bus_assign_domain_nr(struct pci_bus *bus,
+   struct device *parent)
+{
+}
+#endif
+
 #endif /* DRIVERS_PCI_H */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 2b575bc..1542df8 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1327,12 +1327,6 @@ static inline int pci_domain_nr(struct pci_bus *bus)
 {
return bus->domain_nr;
 }
-void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent);
-#else
-static inline void pci_bus_assign_domain_nr(struct pci_bus *bus,
-   struct device *parent)
-{
-}
 #endif
 
 /* some architectures require additional setup to direct VGA traffic */
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 06/30] PCI: Separate pci_host_bridge creation out of pci_create_root_bus()

2015-03-23 Thread Yijing Wang
This patch separate pci_host_bridge creation out
of pci_create_root_bus(), and try to make a generic
pci_host_bridge, then we could make it hold host
bridge specific operations like
pcibios_root_bridge_prepare(). The changes are
transparent to platform host bridge drivers.

Signed-off-by: Yijing Wang 
---
 drivers/pci/host-bridge.c |   52 +
 drivers/pci/pci.h |3 +
 drivers/pci/probe.c   |  113 +
 3 files changed, 108 insertions(+), 60 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index 39b2dbe..7d52a0a 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -8,6 +8,58 @@
 
 #include "pci.h"
 
+static void pci_release_host_bridge_dev(struct device *dev)
+{
+   struct pci_host_bridge *bridge = to_pci_host_bridge(dev);
+
+   if (bridge->release_fn)
+   bridge->release_fn(bridge);
+
+   pci_free_resource_list(>windows);
+   kfree(bridge);
+}
+
+struct pci_host_bridge *pci_create_host_bridge(
+   struct device *parent, int domain, int bus,
+   struct list_head *resources)
+{
+   int error;
+   struct pci_host_bridge *host;
+   struct resource_entry *window, *n;
+
+   host = kzalloc(sizeof(*host), GFP_KERNEL);
+   if (!host)
+   return NULL;
+
+   host->dev.parent = parent;
+   INIT_LIST_HEAD(>windows);
+   resource_list_for_each_entry_safe(window, n, resources)
+   list_move_tail(>node, >windows);
+   /*
+* If support CONFIG_PCI_DOMAINS_GENERIC, use
+* pci_host_assign_domain_nr() to update domain
+* number.
+*/
+   host->domain = domain;
+   pci_host_assign_domain_nr(host);
+   host->dev.release = pci_release_host_bridge_dev;
+   dev_set_name(>dev, "pci%04x:%02x",
+   host->domain, bus);
+
+   error = device_register(>dev);
+   if (error) {
+   put_device(>dev);
+   return NULL;
+   }
+
+   return host;
+}
+
+void pci_free_host_bridge(struct pci_host_bridge *host)
+{
+   device_unregister(>dev);
+}
+
 static struct pci_bus *find_pci_root_bus(struct pci_bus *bus)
 {
while (bus->parent)
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 1d3d2d1..8526790 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -334,4 +334,7 @@ static inline void pci_host_assign_domain_nr(struct 
pci_host_bridge *host)
 }
 #endif
 
+struct pci_host_bridge *pci_create_host_bridge(struct device *parent,
+   int domain, int bus, struct list_head *resources);
+void pci_free_host_bridge(struct pci_host_bridge *host);
 #endif /* DRIVERS_PCI_H */
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 767f009..9bc4784 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -502,31 +502,6 @@ static struct pci_bus *pci_alloc_bus(struct pci_bus 
*parent)
return b;
 }
 
-static void pci_release_host_bridge_dev(struct device *dev)
-{
-   struct pci_host_bridge *bridge = to_pci_host_bridge(dev);
-
-   if (bridge->release_fn)
-   bridge->release_fn(bridge);
-
-   pci_free_resource_list(>windows);
-
-   kfree(bridge);
-}
-
-static struct pci_host_bridge *pci_alloc_host_bridge(struct pci_bus *b)
-{
-   struct pci_host_bridge *bridge;
-
-   bridge = kzalloc(sizeof(*bridge), GFP_KERNEL);
-   if (!bridge)
-   return NULL;
-
-   INIT_LIST_HEAD(>windows);
-   bridge->bus = b;
-   return bridge;
-}
-
 static const unsigned char pcix_bus_speed[] = {
PCI_SPEED_UNKNOWN,  /* 0 */
PCI_SPEED_66MHz_PCIX,   /* 1 */
@@ -1889,19 +1864,20 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 {
 }
 
-struct pci_bus *pci_create_root_bus(struct device *parent, int domain,
-   int bus, struct pci_ops *ops, void *sysdata,
-   struct list_head *resources)
+static struct pci_bus *__pci_create_root_bus(int bus,
+   struct pci_host_bridge *bridge, struct pci_ops *ops,
+   void *sysdata)
 {
int error;
-   struct pci_host_bridge *bridge;
struct pci_bus *b, *b2;
-   struct resource_entry *window, *n;
+   struct resource_entry *window;
+   struct device *parent;
struct resource *res;
resource_size_t offset;
char bus_addr[64];
char *fmt;
 
+   parent = bridge->dev.parent;
b = pci_alloc_bus(NULL);
if (!b)
return NULL;
@@ -1917,26 +1893,12 @@ struct pci_bus *pci_create_root_bus(struct device 
*parent, int domain,
goto err_out;
}
 
-   bridge = pci_alloc_host_bridge(b);
-   if (!bridge)
-   goto err_out;
-
-   bridge->domain = domain;
-   bridge->dev.parent = parent;
-   bridge->dev.release = pci_release_host_bridge_dev;
-   dev_set_name(>dev, "pci%04x:%02x", pci_domain_nr(b), 

[PATCH v8 02/30] PCI: Remove deprecated pci_scan_bus_parented()

2015-03-23 Thread Yijing Wang
No one uses pci_scan_bus_parented() any more,
remove it.

Signed-off-by: Yijing Wang 
---
 drivers/pci/probe.c |   19 ---
 include/linux/pci.h |2 --
 2 files changed, 0 insertions(+), 21 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 8ef0375..699a238 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2091,25 +2091,6 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, 
int bus,
 }
 EXPORT_SYMBOL(pci_scan_root_bus);
 
-/* Deprecated; use pci_scan_root_bus() instead */
-struct pci_bus *pci_scan_bus_parented(struct device *parent,
-   int bus, struct pci_ops *ops, void *sysdata)
-{
-   LIST_HEAD(resources);
-   struct pci_bus *b;
-
-   pci_add_resource(, _resource);
-   pci_add_resource(, _resource);
-   pci_add_resource(, _resource);
-   b = pci_create_root_bus(parent, bus, ops, sysdata, );
-   if (b)
-   pci_scan_child_bus(b);
-   else
-   pci_free_resource_list();
-   return b;
-}
-EXPORT_SYMBOL(pci_scan_bus_parented);
-
 struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
void *sysdata)
 {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 211e9da..36effb8 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -769,8 +769,6 @@ void pcibios_bus_to_resource(struct pci_bus *bus, struct 
resource *res,
 void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
-struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus,
- struct pci_ops *ops, void *sysdata);
 struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata);
 struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
struct pci_ops *ops, void *sysdata,
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 09/30] PCI: Introduce pci_host_first_busnr() function

2015-03-23 Thread Yijing Wang
Use it to get the first bus number of the bus
resource.

Signed-off-by: Yijing Wang 
---
 drivers/pci/pci.h   |   11 +++
 drivers/pci/probe.c |   19 ++-
 2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 8526790..886d72f 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -337,4 +337,15 @@ static inline void pci_host_assign_domain_nr(struct 
pci_host_bridge *host)
 struct pci_host_bridge *pci_create_host_bridge(struct device *parent,
int domain, int bus, struct list_head *resources);
 void pci_free_host_bridge(struct pci_host_bridge *host);
+
+static inline int pci_host_first_busnr(struct pci_host_bridge *host)
+{
+   struct resource_entry *window;
+
+   resource_list_for_each_entry(window, >windows)
+   if (window->res->flags & IORESOURCE_BUS)
+   return window->res->start;
+   return -1;
+}
+
 #endif /* DRIVERS_PCI_H */
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index d5a12d9..25ac741 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1864,7 +1864,7 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 {
 }
 
-static struct pci_bus *__pci_create_root_bus(int bus,
+static struct pci_bus *__pci_create_root_bus(
struct pci_host_bridge *bridge, struct pci_ops *ops,
void *sysdata)
 {
@@ -1884,9 +1884,10 @@ static struct pci_bus *__pci_create_root_bus(int bus,
 
b->sysdata = sysdata;
b->ops = ops;
-   b->number = b->busn_res.start = bus;
+   b->number = b->busn_res.start =
+   pci_host_first_busnr(bridge);
pci_bus_assign_domain_nr(b, parent);
-   b2 = pci_find_bus(pci_domain_nr(b), bus);
+   b2 = pci_find_bus(pci_domain_nr(b), b->number);
if (b2) {
/* If we already got to this bus through a different bridge, 
ignore it */
dev_dbg(>dev, "bus already known\n");
@@ -1907,7 +1908,7 @@ static struct pci_bus *__pci_create_root_bus(int bus,
 
b->dev.class = _class;
b->dev.parent = b->bridge;
-   dev_set_name(>dev, "%04x:%02x", bridge->domain, bus);
+   dev_set_name(>dev, "%04x:%02x", bridge->domain, b->number);
error = device_register(>dev);
if (error)
goto put_dev;
@@ -1927,7 +1928,7 @@ static struct pci_bus *__pci_create_root_bus(int bus,
res = window->res;
offset = window->offset;
if (res->flags & IORESOURCE_BUS)
-   pci_bus_insert_busn_res(b, bus, res->end);
+   pci_bus_insert_busn_res(b, b->number, res->end);
else
pci_bus_add_resource(b, res, 0);
if (offset) {
@@ -1966,7 +1967,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent,
if (!host)
return NULL;
 
-   host->bus = __pci_create_root_bus(bus, host, ops, sysdata);
+   host->bus = __pci_create_root_bus(host, ops, sysdata);
if (!host->bus)
pci_free_host_bridge(host);
 
@@ -2042,14 +2043,14 @@ void pci_bus_release_busn_res(struct pci_bus *b)
res, ret ? "can not be" : "is");
 }
 
-static struct pci_bus *__pci_scan_root_bus(int bus,
+static struct pci_bus *__pci_scan_root_bus(
struct pci_host_bridge *host, struct pci_ops *ops,
void *sysdata)
 {
struct pci_bus *b;
int max;
 
-   b = __pci_create_root_bus(bus, host, ops, sysdata);
+   b = __pci_create_root_bus(host, ops, sysdata);
if (!b)
return NULL;
 
@@ -2074,7 +2075,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, 
int domain,
if (!host)
return NULL;
 
-   host->bus = __pci_scan_root_bus(bus, host, ops, sysdata);
+   host->bus = __pci_scan_root_bus(host, ops, sysdata);
if (!host->bus)
pci_free_host_bridge(host);
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 26/30] PCI/xgene: Use pci_scan_root_bus() instead of pci_create_root_bus()

2015-03-23 Thread Yijing Wang
Use pci_scan_root_bus() instead of pci_create_root_bus() +
pci_scan_child_bus() for simplicity.

Signed-off-by: Yijing Wang 
CC: Tanmay Inamdar 
---
 drivers/pci/host/pci-xgene.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
index 078e853..380c259 100644
--- a/drivers/pci/host/pci-xgene.c
+++ b/drivers/pci/host/pci-xgene.c
@@ -499,12 +499,11 @@ static int xgene_pcie_probe_bridge(struct platform_device 
*pdev)
if (ret)
return ret;
 
-   bus = pci_create_root_bus(>dev, -1, 0,
+   bus = pci_scan_root_bus(>dev, -1, 0,
_pcie_ops, port, );
if (!bus)
return -ENOMEM;
 
-   pci_scan_child_bus(bus);
pci_assign_unassigned_bus_resources(bus);
pci_bus_add_devices(bus);
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 25/30] PCI/designware: Use pci_scan_root_bus() for simplicity

2015-03-23 Thread Yijing Wang
Use pci_scan_root_bus() instead of pci_create_root_bus() +
pci_scan_child_bus() for simplicity.

Signed-off-by: Yijing Wang 
CC: Mohit Kumar 
CC: Jingoo Han 
---
 drivers/pci/host/pcie-designware.c |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/host/pcie-designware.c 
b/drivers/pci/host/pcie-designware.c
index 93778b9..3d7d6fb 100644
--- a/drivers/pci/host/pcie-designware.c
+++ b/drivers/pci/host/pcie-designware.c
@@ -728,13 +728,11 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct 
pci_sys_data *sys)
struct pcie_port *pp = sys_to_pcie(sys);
 
pp->root_bus_nr = sys->busnr;
-   bus = pci_create_root_bus(pp->dev, -1, sys->busnr,
+   bus = pci_scan_root_bus(pp->dev, -1, sys->busnr,
  _pcie_ops, sys, >resources);
if (!bus)
return NULL;
 
-   pci_scan_child_bus(bus);
-
if (bus && pp->ops->scan_bus)
pp->ops->scan_bus(pp);
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 28/30] PCI: Remove platform specific pci_domain_nr()

2015-03-23 Thread Yijing Wang
Now pci_host_bridge holds the domain number,
so we could eliminate all platform specific
pci_domain_nr().

Signed-off-by: Yijing Wang 
Signed-off-by: Bjorn Helgaas 
---
 arch/alpha/include/asm/pci.h |2 --
 arch/ia64/include/asm/pci.h  |1 -
 arch/microblaze/pci/pci-common.c |   11 ---
 arch/mips/include/asm/pci.h  |2 --
 arch/powerpc/kernel/pci-common.c |   11 ---
 arch/s390/pci/pci.c  |6 --
 arch/sh/include/asm/pci.h|2 --
 arch/sparc/kernel/pci.c  |   17 -
 arch/tile/include/asm/pci.h  |2 --
 arch/x86/include/asm/pci.h   |6 --
 drivers/pci/host-bridge.c|   10 ++
 include/linux/pci.h  |7 +--
 12 files changed, 11 insertions(+), 66 deletions(-)

diff --git a/arch/alpha/include/asm/pci.h b/arch/alpha/include/asm/pci.h
index f7f680f..63a9a1e 100644
--- a/arch/alpha/include/asm/pci.h
+++ b/arch/alpha/include/asm/pci.h
@@ -95,8 +95,6 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, 
int channel)
return channel ? 15 : 14;
 }
 
-#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
struct pci_controller *hose = bus->sysdata;
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h
index 52af5ed..1dcea49 100644
--- a/arch/ia64/include/asm/pci.h
+++ b/arch/ia64/include/asm/pci.h
@@ -99,7 +99,6 @@ struct pci_controller {
 
 
 #define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev->sysdata)
-#define pci_domain_nr(busdev)(PCI_CONTROLLER(busdev)->segment)
 
 extern struct pci_ops pci_root_ops;
 
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index d232c8a..6f64908 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -123,17 +123,6 @@ unsigned long pci_address_to_pio(phys_addr_t address)
 }
 EXPORT_SYMBOL_GPL(pci_address_to_pio);
 
-/*
- * Return the domain number for this bus.
- */
-int pci_domain_nr(struct pci_bus *bus)
-{
-   struct pci_controller *hose = pci_bus_to_host(bus);
-
-   return hose->global_number;
-}
-EXPORT_SYMBOL(pci_domain_nr);
-
 /* This routine is meant to be used early during boot, when the
  * PCI bus numbers have not yet been assigned, and you need to
  * issue PCI config cycles to an OF device.
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index 193b4c6..2e4d808 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -122,8 +122,6 @@ static inline void pci_dma_burst_advice(struct pci_dev 
*pdev,
 #endif
 
 #ifdef CONFIG_PCI_DOMAINS
-#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
struct pci_controller *hose = bus->sysdata;
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index e2b50a2..1e20f7e 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -181,17 +181,6 @@ unsigned long pci_address_to_pio(phys_addr_t address)
 }
 EXPORT_SYMBOL_GPL(pci_address_to_pio);
 
-/*
- * Return the domain number for this bus.
- */
-int pci_domain_nr(struct pci_bus *bus)
-{
-   struct pci_controller *hose = pci_bus_to_host(bus);
-
-   return hose->global_number;
-}
-EXPORT_SYMBOL(pci_domain_nr);
-
 /* This routine is meant to be used early during boot, when the
  * PCI bus numbers have not yet been assigned, and you need to
  * issue PCI config cycles to an OF device.
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 7c5199b..d2c108e 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -101,12 +101,6 @@ static struct zpci_dev *get_zdev_by_bus(struct pci_bus 
*bus)
return (bus && bus->sysdata) ? (struct zpci_dev *) bus->sysdata : NULL;
 }
 
-int pci_domain_nr(struct pci_bus *bus)
-{
-   return ((struct zpci_dev *) bus->sysdata)->domain;
-}
-EXPORT_SYMBOL_GPL(pci_domain_nr);
-
 int pci_proc_domain(struct pci_bus *bus)
 {
return pci_domain_nr(bus);
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h
index 5b45115..4dc3ad6 100644
--- a/arch/sh/include/asm/pci.h
+++ b/arch/sh/include/asm/pci.h
@@ -109,8 +109,6 @@ static inline void pci_dma_burst_advice(struct pci_dev 
*pdev,
 /* Board-specific fixup routines. */
 int pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin);
 
-#define pci_domain_nr(bus) ((struct pci_channel *)(bus)->sysdata)->index
-
 static inline int pci_proc_domain(struct pci_bus *bus)
 {
struct pci_channel *hose = bus->sysdata;
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index fa95a1d..57857c7 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -905,23 +905,6 @@ int pcibus_to_node(struct pci_bus *pbus)
 EXPORT_SYMBOL(pcibus_to_node);
 #endif
 
-/* Return the domain number for this pci bus */
-
-int 

[PATCH v8 05/30] PCI: Introduce pci_host_assign_domain_nr() to assign domain

2015-03-23 Thread Yijing Wang
Introduce pci_host_assign_domain_nr() to assign domain
number for pci_host_bridge. In the later patch, we would
assign domain in pci_create_host_bridge, clean up the
pci_bus_assign_domain_nr() and move this function into
drivers/pci/host-bridge.c.

Signed-off-by: Yijing Wang 
---
 drivers/pci/pci.c |   21 -
 drivers/pci/pci.h |4 
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 81f06e8..6677fac 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4501,10 +4501,10 @@ int pci_get_new_domain_nr(void)
 }
 
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
-void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
+static int pci_assign_domain_nr(struct device *dev)
 {
static int use_dt_domains = -1;
-   int domain = of_get_pci_domain_nr(parent->of_node);
+   int domain = of_get_pci_domain_nr(dev->of_node);
 
/*
 * Check DT domain and use_dt_domains values.
@@ -4538,13 +4538,24 @@ void pci_bus_assign_domain_nr(struct pci_bus *bus, 
struct device *parent)
use_dt_domains = 0;
domain = pci_get_new_domain_nr();
} else {
-   dev_err(parent, "Node %s has inconsistent \"linux,pci-domain\" 
property in DT\n",
-   parent->of_node->full_name);
+   dev_err(dev, "Node %s has inconsistent \"linux,pci-domain\" 
property in DT\n",
+   dev->of_node->full_name);
domain = -1;
}
 
-   bus->domain_nr = domain;
+   return domain;
+}
+
+void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
+{
+   bus->domain_nr = pci_assign_domain_nr(parent);
 }
+
+void pci_host_assign_domain_nr(struct pci_host_bridge *host)
+{
+   host->domain = pci_assign_domain_nr(host->dev.parent);
+}
+
 #endif
 #endif
 
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index ba1bcce..1d3d2d1 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -323,11 +323,15 @@ static inline int pci_dev_specific_reset(struct pci_dev 
*dev, int probe)
 
 #ifdef CONFIG_PCI_DOMAINS_GENERIC
 void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent);
+void pci_host_assign_domain_nr(struct pci_host_bridge *host);
 #else
 static inline void pci_bus_assign_domain_nr(struct pci_bus *bus,
struct device *parent)
 {
 }
+static inline void pci_host_assign_domain_nr(struct pci_host_bridge *host)
+{
+}
 #endif
 
 #endif /* DRIVERS_PCI_H */
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 07/30] PCI: Add default bus resource in pci_host_bridge

2015-03-23 Thread Yijing Wang
If there is no busn resource provided for pci_scan_root_bus(),
we would insert a default bus resource (root_bus_number, 255)
in root bus, and update the max bus number we found after
pci_scan_child_bus(). We also need to hold the default bus
resource in pci_host_bridge, then we could identify whether
the new pci host bridge conflict with existing one.

Signed-off-by: Yijing Wang 
---
 drivers/pci/host-bridge.c |   20 
 drivers/pci/probe.c   |   26 ++
 include/linux/pci.h   |2 ++
 3 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index 7d52a0a..ecc1a7c 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -19,6 +19,25 @@ static void pci_release_host_bridge_dev(struct device *dev)
kfree(bridge);
 }
 
+static void pci_host_update_busn_res(
+   struct pci_host_bridge *host, int bus,
+   struct list_head *resources)
+{
+   struct resource_entry *window;
+
+   resource_list_for_each_entry(window, resources)
+   if (window->res->flags & IORESOURCE_BUS)
+   return;
+
+   pr_info(
+"No busn resource found for pci%04x:%02x, will use [bus %02x-ff]\n",
+   host->domain, bus, bus);
+   host->busn_res.flags = IORESOURCE_BUS;
+   host->busn_res.start = bus;
+   host->busn_res.end = 255;
+   pci_add_resource(resources, >busn_res);
+}
+
 struct pci_host_bridge *pci_create_host_bridge(
struct device *parent, int domain, int bus,
struct list_head *resources)
@@ -33,6 +52,7 @@ struct pci_host_bridge *pci_create_host_bridge(
 
host->dev.parent = parent;
INIT_LIST_HEAD(>windows);
+   pci_host_update_busn_res(host, bus, resources);
resource_list_for_each_entry_safe(window, n, resources)
list_move_tail(>node, >windows);
/*
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 9bc4784..d5a12d9 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2022,6 +2022,12 @@ int pci_bus_update_busn_res_end(struct pci_bus *b, int 
bus_max)
return ret;
 }
 
+static void pci_host_update_busn_res_end(
+   struct pci_host_bridge *host, int max)
+{
+   host->busn_res.end = max;
+}
+
 void pci_bus_release_busn_res(struct pci_bus *b)
 {
struct resource *res = >busn_res;
@@ -2040,32 +2046,20 @@ static struct pci_bus *__pci_scan_root_bus(int bus,
struct pci_host_bridge *host, struct pci_ops *ops,
void *sysdata)
 {
-   struct resource_entry *window;
-   bool found = false;
struct pci_bus *b;
int max;
 
-   resource_list_for_each_entry(window, >windows)
-   if (window->res->flags & IORESOURCE_BUS) {
-   found = true;
-   break;
-   }
-
b = __pci_create_root_bus(bus, host, ops, sysdata);
if (!b)
return NULL;
 
-   if (!found) {
-   dev_info(>dev,
-"No busn resource found for root bus, will use [bus 
%02x-ff]\n",
-   bus);
-   pci_bus_insert_busn_res(b, bus, 255);
-   }
-
max = pci_scan_child_bus(b);
 
-   if (!found)
+   /* If default busn resource used, update the max bus number */
+   if (host->busn_res.flags & IORESOURCE_BUS) {
+   pci_host_update_busn_res_end(host, max);
pci_bus_update_busn_res_end(b, max);
+   }
 
return b;
 }
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 1542df8..f189dfb 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -404,6 +404,8 @@ struct pci_host_bridge {
int domain;
struct device dev;
struct pci_bus *bus;/* root bus */
+   /* we use default bus resource if no bus resource provided */
+   struct resource busn_res;
struct list_head windows;   /* resource_entry */
void (*release_fn)(struct pci_host_bridge *);
void *release_data;
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 08/30] PCI: Update pci_host_bridge bus resource

2015-03-23 Thread Yijing Wang
From: Yijing Wang 

Sometimes, the bus resource start number is not equal to
root bus number. For example, in pci_scan_bus(), we always
add the default bus resource which start bus number is 0,
but the root bus number callers given may != 0, so
we need to update pci_host_bridge bus resource, because we
would check whether host bridge bus resoruce is confict
in later patch.

Signed-off-by: Yijing Wang 
---
 drivers/pci/host-bridge.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index ecc1a7c..1a9834b 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -26,8 +26,11 @@ static void pci_host_update_busn_res(
struct resource_entry *window;
 
resource_list_for_each_entry(window, resources)
-   if (window->res->flags & IORESOURCE_BUS)
+   if (window->res->flags & IORESOURCE_BUS) {
+   if (bus > window->res->start)
+   window->res->start = bus;
return;
+   }
 
pr_info(
 "No busn resource found for pci%04x:%02x, will use [bus %02x-ff]\n",
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 10/30] PCI: Introduce pci_host_bridge_list to manage host bridges

2015-03-23 Thread Yijing Wang
Introduce pci_host_bridge_list to manage pci host
bridges in system, this make us have the ability
to check whether the new host would conflict with
existing one. Then we could remove bus alreay exist
check in __pci_create_root_bus().

Signed-off-by: Yijing Wang 
---
 drivers/pci/host-bridge.c |   41 -
 drivers/pci/probe.c   |9 +
 include/linux/pci.h   |1 +
 3 files changed, 42 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index 1a9834b..8af6d51 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -8,6 +8,9 @@
 
 #include "pci.h"
 
+static LIST_HEAD(pci_host_bridge_list);
+static DEFINE_MUTEX(pci_host_mutex);
+
 static void pci_release_host_bridge_dev(struct device *dev)
 {
struct pci_host_bridge *bridge = to_pci_host_bridge(dev);
@@ -41,12 +44,29 @@ static void pci_host_update_busn_res(
pci_add_resource(resources, >busn_res);
 }
 
+static bool pci_host_busn_res_overlap(
+   struct pci_host_bridge *new, struct pci_host_bridge *old)
+{
+   struct resource_entry *entry;
+   struct resource *res1 = NULL, *res2 = NULL;
+
+   resource_list_for_each_entry(entry, >windows)
+   if (entry->res->flags & IORESOURCE_BUS)
+   res1 = entry->res;
+
+   resource_list_for_each_entry(entry, >windows)
+   if (entry->res->flags & IORESOURCE_BUS)
+   res2 = entry->res;
+
+   return resource_overlaps(res1, res2);
+}
+
 struct pci_host_bridge *pci_create_host_bridge(
struct device *parent, int domain, int bus,
struct list_head *resources)
 {
int error;
-   struct pci_host_bridge *host;
+   struct pci_host_bridge *host, *tmp;
struct resource_entry *window, *n;
 
host = kzalloc(sizeof(*host), GFP_KERNEL);
@@ -65,6 +85,21 @@ struct pci_host_bridge *pci_create_host_bridge(
 */
host->domain = domain;
pci_host_assign_domain_nr(host);
+   mutex_lock(_host_mutex);
+   list_for_each_entry(tmp, _host_bridge_list, list) {
+   if (tmp->domain != host->domain
+ || pci_host_busn_res_overlap(host, tmp)) {
+   pr_warn("pci host bridge pci%04x:%02x exist\n",
+   host->domain, bus);
+   mutex_unlock(_host_mutex);
+   pci_free_resource_list(>windows);
+   kfree(host);
+   return NULL;
+   }
+   }
+   list_add_tail(>list, _host_bridge_list);
+   mutex_unlock(_host_mutex);
+
host->dev.release = pci_release_host_bridge_dev;
dev_set_name(>dev, "pci%04x:%02x",
host->domain, bus);
@@ -80,6 +115,10 @@ struct pci_host_bridge *pci_create_host_bridge(
 
 void pci_free_host_bridge(struct pci_host_bridge *host)
 {
+   mutex_lock(_host_mutex);
+   list_del(>list);
+   mutex_unlock(_host_mutex);
+
device_unregister(>dev);
 }
 
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 25ac741..8517d1b 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1869,7 +1869,7 @@ static struct pci_bus *__pci_create_root_bus(
void *sysdata)
 {
int error;
-   struct pci_bus *b, *b2;
+   struct pci_bus *b;
struct resource_entry *window;
struct device *parent;
struct resource *res;
@@ -1887,12 +1887,6 @@ static struct pci_bus *__pci_create_root_bus(
b->number = b->busn_res.start =
pci_host_first_busnr(bridge);
pci_bus_assign_domain_nr(b, parent);
-   b2 = pci_find_bus(pci_domain_nr(b), b->number);
-   if (b2) {
-   /* If we already got to this bus through a different bridge, 
ignore it */
-   dev_dbg(>dev, "bus already known\n");
-   goto err_out;
-   }
 
bridge->bus = b;
b->bridge = get_device(>dev);
@@ -1952,7 +1946,6 @@ static struct pci_bus *__pci_create_root_bus(
 
 put_dev:
put_device(>dev);
-err_out:
kfree(b);
return NULL;
 }
diff --git a/include/linux/pci.h b/include/linux/pci.h
index f189dfb..91cba01 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -407,6 +407,7 @@ struct pci_host_bridge {
/* we use default bus resource if no bus resource provided */
struct resource busn_res;
struct list_head windows;   /* resource_entry */
+   struct list_head list;
void (*release_fn)(struct pci_host_bridge *);
void *release_data;
 };
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 15/30] PCI: Introduce new scan function pci_scan_host_bridge()

2015-03-23 Thread Yijing Wang
Introduce new scan function pci_scan_host_bridge() to
support host bridge drivers that need to provide platform
own pci_host_bridge_ops.

Signed-off-by: Yijing Wang 
---
 drivers/pci/probe.c |   22 ++
 include/linux/pci.h |3 +++
 2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 36dfee0..b3d9b1b 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2064,6 +2064,28 @@ static struct pci_bus *__pci_scan_root_bus(
return b;
 }
 
+struct pci_host_bridge *pci_scan_host_bridge(
+   struct device *parent, int domain, int bus,
+   void *sysdata, struct list_head *resources,
+   struct pci_host_bridge_ops *ops)
+{
+   struct pci_host_bridge *host;
+
+   host = pci_create_host_bridge(parent, domain, bus, sysdata,
+   resources, ops);
+   if (!host)
+   return NULL;
+
+   host->bus = __pci_scan_root_bus(host, ops->pci_ops);
+   if (!host->bus) {
+   pci_free_host_bridge(host);
+   return NULL;
+   }
+
+   return host;
+}
+EXPORT_SYMBOL(pci_scan_host_bridge);
+
 struct pci_bus *pci_scan_root_bus(struct device *parent, int domain,
int bus, struct pci_ops *ops, void *sysdata,
struct list_head *resources)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 2702a51..7f4f182 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -793,6 +793,9 @@ void pci_bus_release_busn_res(struct pci_bus *b);
 struct pci_bus *pci_scan_root_bus(struct device *parent, int domain, int bus,
 struct pci_ops *ops, void *sysdata,
 struct list_head *resources);
+struct pci_host_bridge *pci_scan_host_bridge(struct device *parent, int domain,
+   int bus, void *sysdata, struct list_head *resources,
+   struct pci_host_bridge_ops *ops);
 struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
int busnr);
 void pcie_update_link_speed(struct pci_bus *bus, u16 link_status);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 13/30] PCI: Move pcibios_root_bridge_prepare() to pci_create_host_bridge()

2015-03-23 Thread Yijing Wang
Move pcibios_root_bridge_prepare() to pci_create_host_bridge().

Signed-off-by: Yijing Wang 
---
 drivers/pci/host-bridge.c |   16 +---
 drivers/pci/probe.c   |3 ---
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index b0ed8da..87c4fc5 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -92,9 +92,7 @@ struct pci_host_bridge *pci_create_host_bridge(
pr_warn("pci host bridge pci%04x:%02x exist\n",
host->domain, bus);
mutex_unlock(_host_mutex);
-   pci_free_resource_list(>windows);
-   kfree(host);
-   return NULL;
+   goto free_res;
}
}
list_add_tail(>list, _host_bridge_list);
@@ -105,6 +103,10 @@ struct pci_host_bridge *pci_create_host_bridge(
dev_set_name(>dev, "pci%04x:%02x",
host->domain, bus);
 
+   error = pcibios_root_bridge_prepare(host);
+   if (error)
+   goto list_del;
+
error = device_register(>dev);
if (error) {
put_device(>dev);
@@ -112,6 +114,14 @@ struct pci_host_bridge *pci_create_host_bridge(
}
 
return host;
+list_del:
+   mutex_lock(_host_mutex);
+   list_del(>list);
+   mutex_unlock(_host_mutex);
+free_res:
+   pci_free_resource_list(>windows);
+   kfree(host);
+   return NULL;
 }
 
 void pci_free_host_bridge(struct pci_host_bridge *host)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 418a426..ee17d9a 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1893,9 +1893,6 @@ static struct pci_bus *__pci_create_root_bus(
 
bridge->bus = b;
b->bridge = get_device(>dev);
-   error = pcibios_root_bridge_prepare(bridge);
-   if (error)
-   goto put_dev;
 
pcibios_set_root_bus_speed(bridge);
device_enable_async_suspend(b->bridge);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 12/30] powerpc/PCI: Rename pcibios_root_bridge_prepare() to pcibios_set_root_bus_speed()

2015-03-23 Thread Yijing Wang
pcibios_root_bridge_prepare() in powerpc set
root bus speed, it's not the preparation for
pci host bridge. Rename it for better readability,
and we could move pcibios_root_bridge_prepare()
to pci_create_host_bridge(), in which root bus
is not created. We will clean up these weak functions,
and add pci_host_bridge_ops to do the same thing
in later patch.

Signed-off-by: Yijing Wang 
---
 arch/powerpc/include/asm/machdep.h   |2 +-
 arch/powerpc/kernel/pci-common.c |8 +++-
 arch/powerpc/platforms/pseries/pci.c |8 
 arch/powerpc/platforms/pseries/pseries.h |2 +-
 arch/powerpc/platforms/pseries/setup.c   |2 +-
 drivers/pci/probe.c  |5 +
 6 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/include/asm/machdep.h 
b/arch/powerpc/include/asm/machdep.h
index c8175a3..b811d12 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -129,7 +129,7 @@ struct machdep_calls {
void(*pcibios_fixup)(void);
int (*pci_probe_mode)(struct pci_bus *);
void(*pci_irq_fixup)(struct pci_dev *dev);
-   int (*pcibios_root_bridge_prepare)(struct pci_host_bridge
+   void(*pcibios_set_root_bus_speed)(struct pci_host_bridge
*bridge);
 
/* To setup PHBs when using automatic OF platform driver for PCI */
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 9913f6c..2c58200 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -767,12 +767,10 @@ int pci_proc_domain(struct pci_bus *bus)
return 1;
 }
 
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
+void pcibios_set_root_bus_speed(struct pci_host_bridge *bridge)
 {
-   if (ppc_md.pcibios_root_bridge_prepare)
-   return ppc_md.pcibios_root_bridge_prepare(bridge);
-
-   return 0;
+   if (ppc_md.pcibios_set_root_bus_speed)
+   return ppc_md.pcibios_set_root_bus_speed(bridge);
 }
 
 /* This header fixup will do the resource fixup for all devices as they are
diff --git a/arch/powerpc/platforms/pseries/pci.c 
b/arch/powerpc/platforms/pseries/pci.c
index fe16a50..89ff79c 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -110,7 +110,7 @@ static void fixup_winbond_82c105(struct pci_dev* dev)
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105,
 fixup_winbond_82c105);
 
-int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
+void pseries_set_root_bus_speed(struct pci_host_bridge *bridge)
 {
struct device_node *dn, *pdn;
struct pci_bus *bus;
@@ -121,7 +121,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge 
*bridge)
 
dn = pcibios_get_phb_of_node(bus);
if (!dn)
-   return 0;
+   return;
 
for (pdn = dn; pdn != NULL; pdn = of_get_next_parent(pdn)) {
rc = of_property_read_u32_array(pdn,
@@ -135,7 +135,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge 
*bridge)
 
if (rc) {
pr_debug("no ibm,pcie-link-speed-stats property\n");
-   return 0;
+   return;
}
 
switch (pcie_link_speed_stats[0]) {
@@ -168,5 +168,5 @@ int pseries_root_bridge_prepare(struct pci_host_bridge 
*bridge)
break;
}
 
-   return 0;
+   return;
 }
diff --git a/arch/powerpc/platforms/pseries/pseries.h 
b/arch/powerpc/platforms/pseries/pseries.h
index 1796c54..9aa9c13 100644
--- a/arch/powerpc/platforms/pseries/pseries.h
+++ b/arch/powerpc/platforms/pseries/pseries.h
@@ -63,7 +63,7 @@ extern int dlpar_detach_node(struct device_node *);
 
 /* PCI root bridge prepare function override for pseries */
 struct pci_host_bridge;
-int pseries_root_bridge_prepare(struct pci_host_bridge *bridge);
+void pseries_set_root_bus_speed(struct pci_host_bridge *bridge);
 
 unsigned long pseries_memory_block_size(void);
 
diff --git a/arch/powerpc/platforms/pseries/setup.c 
b/arch/powerpc/platforms/pseries/setup.c
index e445b67..b196c0d 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -496,7 +496,7 @@ static void __init pSeries_setup_arch(void)
ppc_md.enable_pmcs = power4_enable_pmcs;
}
 
-   ppc_md.pcibios_root_bridge_prepare = pseries_root_bridge_prepare;
+   ppc_md.pcibios_set_root_bus_speed = pseries_set_root_bus_speed;
 
if (firmware_has_feature(FW_FEATURE_SET_MODE)) {
long rc;
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 0ac2bf6..418a426 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1856,6 +1856,10 @@ int __weak pcibios_root_bridge_prepare(struct 
pci_host_bridge *bridge)
return 0;
 }
 
+void __weak 

[PATCH v8 17/30] x86/PCI: Refine pci_acpi_scan_root() with generic pci_host_bridge

2015-03-23 Thread Yijing Wang
Signed-off-by: Yijing Wang 
CC: Thomas Gleixner 
CC: x...@kernel.org
---
 arch/x86/pci/acpi.c |   37 +
 1 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index d2655d5..877acaf 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -349,6 +349,19 @@ static void probe_pci_root_info(struct pci_root_info *info,
entry->res->name = info->name;
 }
 
+static int pci_host_bridge_prepare(struct pci_host_bridge *bridge)
+{
+   struct pci_sysdata *sd = dev_get_drvdata(>dev);
+
+   ACPI_COMPANION_SET(>dev, sd->companion);
+   return 0;
+}
+
+static struct pci_host_bridge_ops pci_host_ops = {
+   .pci_ops = _root_ops,
+   .prepare = pci_host_bridge_prepare,
+};
+
 struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 {
struct acpi_device *device = root->device;
@@ -359,6 +372,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root 
*root)
LIST_HEAD(crs_res);
LIST_HEAD(resources);
struct pci_bus *bus;
+   struct pci_host_bridge *host = NULL;
struct pci_sysdata *sd;
int node;
 
@@ -425,14 +439,13 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root 
*root)
 
if (!setup_mcfg_map(info, domain, (u8)root->secondary.start,
(u8)root->secondary.end, root->mcfg_addr))
-   bus = pci_create_root_bus(NULL, domain, busnum,
-   _root_ops, sd, );
-
-   if (bus) {
-   pci_scan_child_bus(bus);
-   pci_set_host_bridge_release(
-   to_pci_host_bridge(bus->bridge),
-   release_pci_root_info, info);
+   host = pci_scan_host_bridge(NULL, domain, busnum, sd,
+   , _host_ops);
+
+   if (host) {
+   bus = host->bus;
+   pci_set_host_bridge_release(host,
+   release_pci_root_info, info);
} else {
resource_list_free();
teardown_mcfg_map(info);
@@ -455,14 +468,6 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root 
*root)
return bus;
 }
 
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
-{
-   struct pci_sysdata *sd = bridge->bus->sysdata;
-
-   ACPI_COMPANION_SET(>dev, sd->companion);
-   return 0;
-}
-
 int __init pci_acpi_init(void)
 {
struct pci_dev *dev = NULL;
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 11/30] PCI: Save sysdata in pci_host_bridge drvdata

2015-03-23 Thread Yijing Wang
Save platform specific sysdata in pci_host_bridge
drvdata, host bridge specific operation need to
access it before the pci bus creation.

Signed-off-by: Yijing Wang 
---
 drivers/pci/host-bridge.c |3 ++-
 drivers/pci/pci.h |2 +-
 drivers/pci/probe.c   |   20 ++--
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index 8af6d51..b0ed8da 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -63,7 +63,7 @@ static bool pci_host_busn_res_overlap(
 
 struct pci_host_bridge *pci_create_host_bridge(
struct device *parent, int domain, int bus,
-   struct list_head *resources)
+   void *sysdata, struct list_head *resources)
 {
int error;
struct pci_host_bridge *host, *tmp;
@@ -101,6 +101,7 @@ struct pci_host_bridge *pci_create_host_bridge(
mutex_unlock(_host_mutex);
 
host->dev.release = pci_release_host_bridge_dev;
+   dev_set_drvdata(>dev, sysdata);
dev_set_name(>dev, "pci%04x:%02x",
host->domain, bus);
 
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 886d72f..027fba0 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -335,7 +335,7 @@ static inline void pci_host_assign_domain_nr(struct 
pci_host_bridge *host)
 #endif
 
 struct pci_host_bridge *pci_create_host_bridge(struct device *parent,
-   int domain, int bus, struct list_head *resources);
+int domain, int bus, void *sysdata, struct list_head *resources);
 void pci_free_host_bridge(struct pci_host_bridge *host);
 
 static inline int pci_host_first_busnr(struct pci_host_bridge *host)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 8517d1b..0ac2bf6 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1865,8 +1865,7 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 }
 
 static struct pci_bus *__pci_create_root_bus(
-   struct pci_host_bridge *bridge, struct pci_ops *ops,
-   void *sysdata)
+   struct pci_host_bridge *bridge, struct pci_ops *ops)
 {
int error;
struct pci_bus *b;
@@ -1882,7 +1881,7 @@ static struct pci_bus *__pci_create_root_bus(
if (!b)
return NULL;
 
-   b->sysdata = sysdata;
+   b->sysdata = dev_get_drvdata(>dev);
b->ops = ops;
b->number = b->busn_res.start =
pci_host_first_busnr(bridge);
@@ -1956,11 +1955,12 @@ struct pci_bus *pci_create_root_bus(struct device 
*parent,
 {
struct pci_host_bridge *host;
 
-   host = pci_create_host_bridge(parent, domain, bus, resources);
+   host = pci_create_host_bridge(parent, domain, bus,
+   sysdata, resources);
if (!host)
return NULL;
 
-   host->bus = __pci_create_root_bus(host, ops, sysdata);
+   host->bus = __pci_create_root_bus(host, ops);
if (!host->bus)
pci_free_host_bridge(host);
 
@@ -2037,13 +2037,12 @@ void pci_bus_release_busn_res(struct pci_bus *b)
 }
 
 static struct pci_bus *__pci_scan_root_bus(
-   struct pci_host_bridge *host, struct pci_ops *ops,
-   void *sysdata)
+   struct pci_host_bridge *host, struct pci_ops *ops)
 {
struct pci_bus *b;
int max;
 
-   b = __pci_create_root_bus(host, ops, sysdata);
+   b = __pci_create_root_bus(host, ops);
if (!b)
return NULL;
 
@@ -2064,11 +2063,12 @@ struct pci_bus *pci_scan_root_bus(struct device 
*parent, int domain,
 {
struct pci_host_bridge *host;
 
-   host = pci_create_host_bridge(parent, domain, bus, resources);
+   host = pci_create_host_bridge(parent, domain, bus,
+   sysdata, resources);
if (!host)
return NULL;
 
-   host->bus = __pci_scan_root_bus(host, ops, sysdata);
+   host->bus = __pci_scan_root_bus(host, ops);
if (!host->bus)
pci_free_host_bridge(host);
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 21/30] sparc/PCI: Use pci_scan_host_bridge() for simplicity

2015-03-23 Thread Yijing Wang
Now we could use pci_scan_host_bridge() to scan
pci buses, provide sparc specific pci_host_bridge_ops.

Signed-off-by: Yijing Wang 
CC: "David S. Miller" 
CC: sparcli...@vger.kernel.org
---
 arch/sparc/kernel/pci.c |   28 ++--
 1 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index e40e456..fa95a1d 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -650,12 +650,27 @@ static void pci_claim_bus_resources(struct pci_bus *bus)
pci_claim_bus_resources(child_bus);
 }
 
+static int pci_host_of_scan_bus(
+   struct pci_host_bridge *host)
+{
+   struct pci_pbm_info *pbm = dev_get_drvdata(>dev);
+   struct device_node *node = pbm->op->dev.of_node;
+
+   pci_of_scan_bus(pbm, node, host->bus);
+   return pci_bus_child_max_busnr(host->bus);
+}
+
+static struct pci_host_bridge_ops pci_host_ops = {
+   .scan_bus = pci_host_of_scan_bus,
+};
+
 struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
 struct device *parent)
 {
LIST_HEAD(resources);
struct device_node *node = pbm->op->dev.of_node;
struct pci_bus *bus;
+   struct pci_host_bridge *host;
 
printk("PCI: Scanning PBM %s\n", node->full_name);
 
@@ -667,16 +682,17 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
pbm->busn.end   = pbm->pci_last_busno;
pbm->busn.flags = IORESOURCE_BUS;
pci_add_resource(, >busn);
-   bus = pci_create_root_bus(parent, pbm->index, pbm->pci_first_busno,
-   pbm->pci_ops, pbm, );
-   if (!bus) {
-   printk(KERN_ERR "Failed to create bus for %s\n",
-  node->full_name);
+   pci_host_ops.pci_ops = pbm->pci_ops;
+   host = pci_scan_host_bridge(parent, pbm->index, pbm->pci_first_busno,
+   pbm, , _host_ops);
+   if (!host) {
+   pr_err("Failed to create host bridge pci%04x:%02x for %s\n",
+  pbm->index, pbm->pci_first_busno, node->full_name);
pci_free_resource_list();
return NULL;
}
 
-   pci_of_scan_bus(pbm, node, bus);
+   bus = host->bus;
pci_bus_register_of_sysfs(bus);
 
pci_claim_bus_resources(bus);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 00/30] Refine PCI scan interfaces and make generic pci host bridge

2015-03-23 Thread Yijing Wang
v7->v8:
Fix some cross building errors found by kbuild test.
Drop the rename patch for find_pci_host_bridge().
v6->v7:
Drop previous patch which combined the domain and bus in one argument.
Make the pci_host_bridge hold the default busn resource, so we could
check whether new host busn resource is conflict with existing ones.
Move pci_host_assign_domain_nr() to drivers/pci/host-bridge.c
Other changes suggested by Bjorn and Suravee.
v5->v6:
Fix cross building errors found by kbuild test.
Export busn_resource to Xen pcifront driver.
v4->v5:
Fix some code style issues and rename some functions suggested by Bjorn.
Fix some code flaw(Eg. call pci_bus_add_devices() before resources claim
or lack the return checking).
v3->v4:
Fix the rebase issue.
v2->v3:
Rebase this series on v4.0-rc1.
v1->v2:
Split pci_host_bridge_list into a new patch, remove .phb_probe_mode
and rework powerpc .phb_of_scan_bus() for simpilicty suggested by
Arnd. Refresh some patch description log, and add a new patch to fix
build warning in ia64.

This series is based on Bjorn's pci/enumeration branch.

Now in kernel, we scan pci bus use the following ways:
1. pci_scan_bus. 
parent = NULL, default io/mem/bus resources
call pci_bus_add_devices()

2. pci_scan_bus_parented() + pci_bus_add_devices()
default io/mem/bus resources, only used by xen

3. pci_scan_root_bus() + pci_bus_add_devices()

4. pci_create_root_bus() + pci_scan_child_bus() + pci_bus_add_devices()

5. pci_create_root_bus() + xx_of_scan_bus()  +  pci_bus_add_devices()

And we have a lot of arch specific pci_domain_nr() and other platform
specific weak function like pcibios_root_bridge_prepare().

After applied this series, we have following scan interfaces:

1. pci_scan_bus() 
parent = NULL, default io/mem/bus resources.
for legacy pci scan

2. pci_scan_root_bus()
for callers provide its own parent and io/mem/bus resources
but no platform specific pci_host_bridge operations

3. pci_scan_host_bridge()
for callers provide its own parent and io/mem/bus resources

Arnd Bergmann (1):
  xen/PCI: Don't use deprecated function pci_scan_bus_parented()

Yijing Wang (29):
  PCI: Remove deprecated pci_scan_bus_parented()
  PCI: Save domain in pci_host_bridge
  PCI: Move pci_bus_assign_domain_nr() declaration into
drivers/pci/pci.h
  PCI: Introduce pci_host_assign_domain_nr() to assign domain
  PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
  PCI: Add default bus resource in pci_host_bridge
  PCI: Update pci_host_bridge bus resource
  PCI: Introduce pci_host_first_busnr() function
  PCI: Introduce pci_host_bridge_list to manage host bridges
  PCI: Save sysdata in pci_host_bridge drvdata
  powerpc/PCI: Rename pcibios_root_bridge_prepare() to
pcibios_set_root_bus_speed()
  PCI: Move pcibios_root_bridge_prepare() to pci_create_host_bridge()
  PCI: Introduce pci_host_bridge_ops to support host specific
operations
  PCI: Introduce new scan function pci_scan_host_bridge()
  PCI: Introduce pci_bus_child_max_busnr()
  x86/PCI: Refine pci_acpi_scan_root() with generic pci_host_bridge
  ia64/PCI: Refine pci_acpi_scan_root() with generic pci_host_bridge
  powerpc/pci: Use pci_scan_host_bridge() for simplicity
  PCI: Remove pcibios_root_bridge_prepare() and
pcibos_set_root_bus_speed()
  sparc/PCI: Use pci_scan_host_bridge() for simplicity
  parisc/PCI: Use pci_scan_root_bus() for simplicity
  PCI/mvebu: Use pci_common_init_dev() to simplify code
  PCI/tegra: Remove redundant tegra_pcie_scan_bus()
  PCI/designware: Use pci_scan_root_bus() for simplicity
  PCI/xgene: Use pci_scan_root_bus() instead of pci_create_root_bus()
  PCI: Rename __pci_create_root_bus() to pci_create_root_bus()
  PCI: Remove platform specific pci_domain_nr()
  PCI: Remove pci_bus_assign_domain_nr()
  PCI: Clean up CONFIG_PCI_DOMAINS_GENERIC

 arch/alpha/include/asm/pci.h |2 -
 arch/alpha/kernel/pci.c  |4 +-
 arch/alpha/kernel/sys_nautilus.c |2 +-
 arch/arm/Kconfig |3 -
 arch/arm/kernel/bios32.c |2 +-
 arch/arm/mach-dove/pcie.c|2 +-
 arch/arm/mach-iop13xx/pci.c  |4 +-
 arch/arm/mach-mv78xx0/pcie.c |2 +-
 arch/arm/mach-orion5x/pci.c  |4 +-
 arch/arm64/Kconfig   |3 -
 arch/frv/mb93090-mb00/pci-vdk.c  |3 +-
 arch/ia64/include/asm/pci.h  |1 -
 arch/ia64/pci/pci.c  |   34 +++--
 arch/ia64/sn/kernel/io_init.c|4 +-
 arch/m68k/coldfire/pci.c |2 +-
 arch/microblaze/pci/pci-common.c |   15 +--
 arch/mips/include/asm/pci.h  |2 -
 arch/mips/pci/pci.c  |4 +-
 arch/mn10300/unit-asb2305/pci.c

Re: [pci:pci/enumeration-yw7 32/35] drivers/pci/host-bridge.c:147:24: sparse: symbol 'pci_find_host_bridge' was not declared. Should it be static?

2015-03-23 Thread Yijing Wang
On 2015/3/24 10:29, Bjorn Helgaas wrote:
> On Mon, Mar 23, 2015 at 8:15 PM, Yijing Wang  wrote:
 sparse warnings: (new ones prefixed by >>)

>> drivers/pci/host-bridge.c:147:24: sparse: symbol 'pci_find_host_bridge' 
>> was not declared. Should it be static?

 Please review and possibly fold the followup patch.
>>>
>>> It does look like pci_find_host_bridge() is only used inside
>>> drivers/pci/host-bridge.c and could be static.  Given that it's only
>>> used there, it doesn't even need to be renamed, so maybe you could
>>> even just drop the rename patch, too.
>>
>> OK.
>>
>> Hi Bjorn, because this series involved lots platforms and host bridge chips, 
>> and this version takes a lot of changes.
>> So I didn't take lot of time to cross build this series in all the platforms 
>> in my local. I hope you could see the changes
>> first, and I will refresh and fix the details soon.
> 
> I just put them on a branch for build testing.  I will review them
> more closely when the build problems are resolved.
> 
> FYI, I'll be on vacation from Mar 25 - Apr 2, so I won't be able to do
> much then.

OK, I post out the new v8 version which fixed the build problems and drop the 
unnecessary patch.

Happy vacation!

Thanks!
Yijing.

> 
> Bjorn
> 
> 


-- 
Thanks!
Yijing

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 19/30] powerpc/pci: Use pci_scan_host_bridge() for simplicity

2015-03-23 Thread Yijing Wang
Now we could use pci_scan_host_bridge() to scan
pci buses, provide powerpc specific pci_host_bridge_ops.

Signed-off-by: Yijing Wang 
CC: Benjamin Herrenschmidt 
CC: linuxppc-...@lists.ozlabs.org
---
 arch/powerpc/kernel/pci-common.c |   60 +++--
 1 files changed, 37 insertions(+), 23 deletions(-)

diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 2c58200..e2b50a2 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -773,6 +773,29 @@ void pcibios_set_root_bus_speed(struct pci_host_bridge 
*bridge)
return ppc_md.pcibios_set_root_bus_speed(bridge);
 }
 
+static int pci_host_scan_bus(struct pci_host_bridge *host)
+{
+   int mode = PCI_PROBE_NORMAL;
+   struct pci_bus *bus = host->bus;
+   struct pci_controller *hose = dev_get_drvdata(>dev);
+
+   /* Get probe mode and perform scan */
+   if (hose->dn && ppc_md.pci_probe_mode)
+   mode = ppc_md.pci_probe_mode(bus);
+
+   pr_debug("probe mode: %d\n", mode);
+   if (mode == PCI_PROBE_DEVTREE)
+   of_scan_bus(hose->dn, bus);
+
+   if (mode == PCI_PROBE_NORMAL) {
+   pci_bus_update_busn_res_end(bus, 255);
+   hose->last_busno = pci_scan_child_bus(bus);
+   pci_bus_update_busn_res_end(bus, hose->last_busno);
+   }
+
+   return pci_bus_child_max_busnr(bus);
+}
+
 /* This header fixup will do the resource fixup for all devices as they are
  * probed, but not for bridge ranges
  */
@@ -1585,6 +1608,11 @@ struct device_node *pcibios_get_phb_of_node(struct 
pci_bus *bus)
return of_node_get(hose->dn);
 }
 
+static struct pci_host_bridge_ops pci_host_ops = {
+   .set_root_bus_speed = pcibios_set_root_bus_speed,
+   .scan_bus = pci_host_scan_bus,
+};
+
 /**
  * pci_scan_phb - Given a pci_controller, setup and scan the PCI bus
  * @hose: Pointer to the PCI host controller instance structure
@@ -1592,9 +1620,8 @@ struct device_node *pcibios_get_phb_of_node(struct 
pci_bus *bus)
 void pcibios_scan_phb(struct pci_controller *hose)
 {
LIST_HEAD(resources);
-   struct pci_bus *bus;
+   struct pci_host_bridge *host;
struct device_node *node = hose->dn;
-   int mode;
 
pr_debug("PCI: Scanning PHB %s\n", of_node_full_name(node));
 
@@ -1609,31 +1636,18 @@ void pcibios_scan_phb(struct pci_controller *hose)
hose->busn.flags = IORESOURCE_BUS;
pci_add_resource(, >busn);
 
+   pci_host_ops.pci_ops = hose->ops;
/* Create an empty bus for the toplevel */
-   bus = pci_create_root_bus(hose->parent, hose->global_number,
-   hose->first_busno, hose->ops, hose, );
-   if (bus == NULL) {
-   pr_err("Failed to create bus for PCI domain %04x\n",
-   hose->global_number);
+   host = pci_scan_host_bridge(hose->parent, hose->global_number,
+   hose->first_busno, hose, , _host_ops);
+   if (host == NULL) {
+   pr_err("Failed to create host bridge for pci%04x:%02x\n",
+   hose->global_number, hose->first_busno);
pci_free_resource_list();
return;
}
hose->bus = bus;
 
-   /* Get probe mode and perform scan */
-   mode = PCI_PROBE_NORMAL;
-   if (node && ppc_md.pci_probe_mode)
-   mode = ppc_md.pci_probe_mode(bus);
-   pr_debug("probe mode: %d\n", mode);
-   if (mode == PCI_PROBE_DEVTREE)
-   of_scan_bus(node, bus);
-
-   if (mode == PCI_PROBE_NORMAL) {
-   pci_bus_update_busn_res_end(bus, 255);
-   hose->last_busno = pci_scan_child_bus(bus);
-   pci_bus_update_busn_res_end(bus, hose->last_busno);
-   }
-
/* Platform gets a chance to do some global fixups before
 * we proceed to resource allocation
 */
@@ -1641,9 +1655,9 @@ void pcibios_scan_phb(struct pci_controller *hose)
ppc_md.pcibios_fixup_phb(hose);
 
/* Configure PCI Express settings */
-   if (bus && !pci_has_flag(PCI_PROBE_ONLY)) {
+   if (host->bus && !pci_has_flag(PCI_PROBE_ONLY)) {
struct pci_bus *child;
-   list_for_each_entry(child, >children, node)
+   list_for_each_entry(child, >bus->children, node)
pcie_bus_configure_settings(child);
}
 }
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 23/30] PCI/mvebu: Use pci_common_init_dev() to simplify code

2015-03-23 Thread Yijing Wang
Mvebu_pcie_scan_bus() is not necessary, we could use
pci_common_init_dev() instead of pci_common_init(),
and pass the device pointer as the parent. Then
pci_scan_root_bus() will be called to scan the pci busses.

Signed-off-by: Yijing Wang 
CC: Thomas Petazzoni 
CC: Jason Cooper 
---
 drivers/pci/host/pci-mvebu.c |   18 +-
 1 files changed, 1 insertions(+), 17 deletions(-)

diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index 0cfc494..d5a2b70 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -750,21 +750,6 @@ static int mvebu_pcie_setup(int nr, struct pci_sys_data 
*sys)
return 1;
 }
 
-static struct pci_bus *mvebu_pcie_scan_bus(int nr, struct pci_sys_data *sys)
-{
-   struct mvebu_pcie *pcie = sys_to_pcie(sys);
-   struct pci_bus *bus;
-
-   bus = pci_create_root_bus(>pdev->dev, -1, sys->busnr,
- _pcie_ops, sys, >resources);
-   if (!bus)
-   return NULL;
-
-   pci_scan_child_bus(bus);
-
-   return bus;
-}
-
 static resource_size_t mvebu_pcie_align_resource(struct pci_dev *dev,
 const struct resource *res,
 resource_size_t start,
@@ -808,12 +793,11 @@ static void mvebu_pcie_enable(struct mvebu_pcie *pcie)
hw.nr_controllers = 1;
hw.private_data   = (void **)
hw.setup  = mvebu_pcie_setup;
-   hw.scan   = mvebu_pcie_scan_bus;
hw.map_irq= of_irq_parse_and_map_pci;
hw.ops= _pcie_ops;
hw.align_resource = mvebu_pcie_align_resource;
 
-   pci_common_init();
+   pci_common_init_dev(>pdev->dev, );
 }
 
 /*
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 29/30] PCI: Remove pci_bus_assign_domain_nr()

2015-03-23 Thread Yijing Wang
Now we save the domain number in pci_host_bridge,
we could remove pci_bus_assign_domain_nr() and
clean the domain member in pci_bus. Also move
pci_host_assign_domain_nr() to drivers/pci/host-bridge.c
for simplicity.

Signed-off-by: Yijing Wang 
---
 drivers/pci/host-bridge.c |   63 ++
 drivers/pci/pci.c |   67 -
 drivers/pci/pci.h |   13 -
 drivers/pci/probe.c   |   11 ++-
 include/linux/pci.h   |3 --
 5 files changed, 66 insertions(+), 91 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index e68b6c8..c78f4d0 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -11,6 +11,8 @@
 static LIST_HEAD(pci_host_bridge_list);
 static DEFINE_MUTEX(pci_host_mutex);
 
+static void pci_host_assign_domain_nr(struct pci_host_bridge *host);
+
 static void pci_release_host_bridge_dev(struct device *dev)
 {
struct pci_host_bridge *bridge = to_pci_host_bridge(dev);
@@ -159,8 +161,69 @@ int pci_domain_nr(struct pci_bus *bus)
return host->domain;
 }
 EXPORT_SYMBOL(pci_domain_nr);
+
+static atomic_t __domain_nr = ATOMIC_INIT(-1);
+
+int pci_get_new_domain_nr(void)
+{
+   return atomic_inc_return(&__domain_nr);
+}
+
+#ifdef CONFIG_PCI_DOMAINS_GENERIC
+static int pci_assign_domain_nr(struct device *dev)
+{
+   static int use_dt_domains = -1;
+   int domain = of_get_pci_domain_nr(dev->of_node);
+
+   /*
+* Check DT domain and use_dt_domains values.
+*
+* If DT domain property is valid (domain >= 0) and
+* use_dt_domains != 0, the DT assignment is valid since this means
+* we have not previously allocated a domain number by using
+* pci_get_new_domain_nr(); we should also update use_dt_domains to
+* 1, to indicate that we have just assigned a domain number from
+* DT.
+*
+* If DT domain property value is not valid (ie domain < 0), and we
+* have not previously assigned a domain number from DT
+* (use_dt_domains != 1) we should assign a domain number by
+* using the:
+*
+* pci_get_new_domain_nr()
+*
+* API and update the use_dt_domains value to keep track of method we
+* are using to assign domain numbers (use_dt_domains = 0).
+*
+* All other combinations imply we have a platform that is trying
+* to mix domain numbers obtained from DT and pci_get_new_domain_nr(),
+* which is a recipe for domain mishandling and it is prevented by
+* invalidating the domain value (domain = -1) and printing a
+* corresponding error.
+*/
+   if (domain >= 0 && use_dt_domains) {
+   use_dt_domains = 1;
+   } else if (domain < 0 && use_dt_domains != 1) {
+   use_dt_domains = 0;
+   domain = pci_get_new_domain_nr();
+   } else {
+   dev_err(dev, "Node %s has inconsistent \"linux,pci-domain\" 
property in DT\n",
+   dev->of_node->full_name);
+   domain = -1;
+   }
+
+   return domain;
+}
+#endif
 #endif
 
+void pci_host_assign_domain_nr(struct pci_host_bridge *host)
+{
+#ifdef CONFIG_PCI_DOMAINS_GENERIC
+   host->domain = pci_assign_domain_nr(host->dev.parent);
+#endif
+}
+
 void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
 void (*release_fn)(struct pci_host_bridge *),
 void *release_data)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 8a2f12c..044801c 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4515,73 +4515,6 @@ static void pci_no_domains(void)
 #endif
 }
 
-#ifdef CONFIG_PCI_DOMAINS
-static atomic_t __domain_nr = ATOMIC_INIT(-1);
-
-int pci_get_new_domain_nr(void)
-{
-   return atomic_inc_return(&__domain_nr);
-}
-
-#ifdef CONFIG_PCI_DOMAINS_GENERIC
-static int pci_assign_domain_nr(struct device *dev)
-{
-   static int use_dt_domains = -1;
-   int domain = of_get_pci_domain_nr(dev->of_node);
-
-   /*
-* Check DT domain and use_dt_domains values.
-*
-* If DT domain property is valid (domain >= 0) and
-* use_dt_domains != 0, the DT assignment is valid since this means
-* we have not previously allocated a domain number by using
-* pci_get_new_domain_nr(); we should also update use_dt_domains to
-* 1, to indicate that we have just assigned a domain number from
-* DT.
-*
-* If DT domain property value is not valid (ie domain < 0), and we
-* have not previously assigned a domain number from DT
-* (use_dt_domains != 1) we should assign a domain number by
-* using the:
-*
-* pci_get_new_domain_nr()
-*
-* API and update the use_dt_domains value to keep track of method we
-* are using to assign 

[PATCH v8 30/30] PCI: Clean up CONFIG_PCI_DOMAINS_GENERIC

2015-03-23 Thread Yijing Wang
Now we could clean up CONFIG_PCI_DOMAINS_GENERIC.

Signed-off-by: Yijing Wang 
---
 arch/arm/Kconfig  |3 ---
 arch/arm64/Kconfig|3 ---
 drivers/pci/host-bridge.c |   11 ++-
 drivers/pci/pci.c |2 --
 4 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 9f1f09a..b5dab6c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1283,9 +1283,6 @@ config PCI_DOMAINS
bool
depends on PCI
 
-config PCI_DOMAINS_GENERIC
-   def_bool PCI_DOMAINS
-
 config PCI_NANOENGINE
bool "BSE nanoEngine PCI support"
depends on SA1100_NANOENGINE
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 1b8e973..4b1cc27 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -242,9 +242,6 @@ config PCI
 config PCI_DOMAINS
def_bool PCI
 
-config PCI_DOMAINS_GENERIC
-   def_bool PCI
-
 config PCI_SYSCALL
def_bool PCI
 
diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index c78f4d0..18a0f6c 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -4,6 +4,8 @@
 
 #include 
 #include 
+#include 
+#include 
 #include 
 
 #include "pci.h"
@@ -82,12 +84,13 @@ struct pci_host_bridge *pci_create_host_bridge(
resource_list_for_each_entry_safe(window, n, resources)
list_move_tail(>node, >windows);
/*
-* If support CONFIG_PCI_DOMAINS_GENERIC, use
+* If domain == -1, we need to use
 * pci_host_assign_domain_nr() to update domain
 * number.
 */
host->domain = domain;
-   pci_host_assign_domain_nr(host);
+   if (host->domain == -1)
+   pci_host_assign_domain_nr(host);
mutex_lock(_host_mutex);
list_for_each_entry(tmp, _host_bridge_list, list) {
if (tmp->domain != host->domain
@@ -169,7 +172,6 @@ int pci_get_new_domain_nr(void)
return atomic_inc_return(&__domain_nr);
 }
 
-#ifdef CONFIG_PCI_DOMAINS_GENERIC
 static int pci_assign_domain_nr(struct device *dev)
 {
static int use_dt_domains = -1;
@@ -215,11 +217,10 @@ static int pci_assign_domain_nr(struct device *dev)
return domain;
 }
 #endif
-#endif
 
 void pci_host_assign_domain_nr(struct pci_host_bridge *host)
 {
-#ifdef CONFIG_PCI_DOMAINS_GENERIC
+#ifdef CONFIG_PCI_DOMAINS
host->domain = pci_assign_domain_nr(host->dev.parent);
 #endif
 }
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 044801c..5b18429 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -10,8 +10,6 @@
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 #include 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 24/30] PCI/tegra: Remove redundant tegra_pcie_scan_bus()

2015-03-23 Thread Yijing Wang
Now pci_scan_root_bus() is almost similar to
pci_create_root_bus() + pci_scan_child_bus().
So we could use common pci_scan_root_bus() in
pci_common_init_dev() to scan pci busses.
tegra_pcie_scan_bus() is redundant, remove it.

Signed-off-by: Yijing Wang 
CC: Thierry Reding 
CC: linux-te...@vger.kernel.org
---
 drivers/pci/host/pci-tegra.c |   16 
 1 files changed, 0 insertions(+), 16 deletions(-)

diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 94e9362..10c0571 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -630,21 +630,6 @@ static int tegra_pcie_map_irq(const struct pci_dev *pdev, 
u8 slot, u8 pin)
return irq;
 }
 
-static struct pci_bus *tegra_pcie_scan_bus(int nr, struct pci_sys_data *sys)
-{
-   struct tegra_pcie *pcie = sys_to_pcie(sys);
-   struct pci_bus *bus;
-
-   bus = pci_create_root_bus(pcie->dev, -1, sys->busnr, _pcie_ops,
-   sys, >resources);
-   if (!bus)
-   return NULL;
-
-   pci_scan_child_bus(bus);
-
-   return bus;
-}
-
 static irqreturn_t tegra_pcie_isr(int irq, void *arg)
 {
const char *err_msg[] = {
@@ -1831,7 +1816,6 @@ static int tegra_pcie_enable(struct tegra_pcie *pcie)
hw.private_data = (void **)
hw.setup = tegra_pcie_setup;
hw.map_irq = tegra_pcie_map_irq;
-   hw.scan = tegra_pcie_scan_bus;
hw.ops = _pcie_ops;
 
pci_common_init_dev(pcie->dev, );
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 22/30] parisc/PCI: Use pci_scan_root_bus() for simplicity

2015-03-23 Thread Yijing Wang
From: Yijing Wang 

Now pci_bus_add_devices() has been ripped out
from pci_scan_root_bus(), we could use pci_scan_root_bus()
instead of pci_create_root_bus() + pci_scan_child_bus()
for simplicity.

Signed-off-by: Yijing Wang 
CC: "James E.J. Bottomley" 
CC: linux-par...@vger.kernel.org
---
 drivers/parisc/dino.c|4 ++--
 drivers/parisc/lba_pci.c |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c
index f375252..146c3ff 100644
--- a/drivers/parisc/dino.c
+++ b/drivers/parisc/dino.c
@@ -985,7 +985,7 @@ static int __init dino_probe(struct parisc_device *dev)
** It's not used to avoid chicken/egg problems
** with configuration accessor functions.
*/
-   dino_dev->hba.hba_bus = bus = pci_create_root_bus(>dev,
+   dino_dev->hba.hba_bus = bus = pci_scan_root_bus(>dev,
 0, dino_current_bus, _cfg_ops, NULL, );
if (!bus) {
printk(KERN_ERR "ERROR: failed to scan PCI bus on %s (duplicate 
bus number %d?)\n",
@@ -996,7 +996,7 @@ static int __init dino_probe(struct parisc_device *dev)
return 0;
}
 
-   max = pci_scan_child_bus(bus);
+   max = pci_bus_child_max_busnr(bus);
pci_bus_update_busn_res_end(bus, max);
 
/* This code *depends* on scanning being single threaded
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c
index 2949030..b630364 100644
--- a/drivers/parisc/lba_pci.c
+++ b/drivers/parisc/lba_pci.c
@@ -1563,14 +1563,14 @@ lba_driver_probe(struct parisc_device *dev)
 
dev->dev.platform_data = lba_dev;
lba_bus = lba_dev->hba.hba_bus =
-   pci_create_root_bus(>dev, 0, lba_dev->hba.bus_num.start,
+   pci_scan_root_bus(>dev, 0, lba_dev->hba.bus_num.start,
cfg_ops, NULL, );
if (!lba_bus) {
pci_free_resource_list();
return 0;
}
 
-   max = pci_scan_child_bus(lba_bus);
+   max = pci_bus_child_max_busnr(lba_bus);
 
/* This is in lieu of calling pci_assign_unassigned_resources() */
if (is_pdc_pat()) {
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 20/30] PCI: Remove pcibios_root_bridge_prepare() and pcibos_set_root_bus_speed()

2015-03-23 Thread Yijing Wang
Now no one use weak pcibios_root_bridge_prepare() and
pcibios_set_root_bus_speed, we could clean up them.

Signed-off-by: Yijing Wang 
---
 drivers/pci/host-bridge.c |4 
 drivers/pci/probe.c   |   18 +-
 include/linux/pci.h   |2 --
 3 files changed, 1 insertions(+), 23 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index b439264..919ba4d 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -110,10 +110,6 @@ struct pci_host_bridge *pci_create_host_bridge(
goto list_del;
}
 
-   error = pcibios_root_bridge_prepare(host);
-   if (error)
-   goto list_del;
-
error = device_register(>dev);
if (error) {
put_device(>dev);
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index b3d9b1b..7796bf8 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1844,22 +1844,6 @@ unsigned int pci_scan_child_bus(struct pci_bus *bus)
 }
 EXPORT_SYMBOL_GPL(pci_scan_child_bus);
 
-/**
- * pcibios_root_bridge_prepare - Platform-specific host bridge setup.
- * @bridge: Host bridge to set up.
- *
- * Default empty implementation.  Replace with an architecture-specific setup
- * routine, if necessary.
- */
-int __weak pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
-{
-   return 0;
-}
-
-void __weak pcibios_set_root_bus_speed(struct pci_host_bridge *bridge)
-{
-}
-
 void __weak pcibios_add_bus(struct pci_bus *bus)
 {
 }
@@ -1896,7 +1880,7 @@ static struct pci_bus *__pci_create_root_bus(
 
if (bridge->ops && bridge->ops->set_root_bus_speed)
bridge->ops->set_root_bus_speed(bridge);
-   pcibios_set_root_bus_speed(bridge);
+
device_enable_async_suspend(b->bridge);
pci_set_bus_of_node(b);
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 0b921d6..61e0853 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -426,8 +426,6 @@ void pci_set_host_bridge_release(struct pci_host_bridge 
*bridge,
 void (*release_fn)(struct pci_host_bridge *),
 void *release_data);
 
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
-
 /*
  * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
  * to P2P or CardBus bridge windows) go in a table.  Additional ones (for
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 18/30] ia64/PCI: Refine pci_acpi_scan_root() with generic pci_host_bridge

2015-03-23 Thread Yijing Wang
From: Yijing Wang 

Signed-off-by: Yijing Wang 
CC: Tony Luck 
CC: Fenghua Yu 
CC: linux-i...@vger.kernel.org
---
 arch/ia64/pci/pci.c |   34 +++---
 1 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index c642bc8..95dc43b 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -420,6 +420,19 @@ probe_pci_root_info(struct pci_root_info *info, struct 
acpi_device *device,
return 0;
 }
 
+static int pci_host_bridge_prepare(struct pci_host_bridge *bridge)
+{
+   struct pci_controller *controller = bridge->bus->sysdata;
+
+   ACPI_COMPANION_SET(>dev, controller->companion);
+   return 0;
+}
+
+static struct pci_host_bridge_ops pci_host_ops = {
+   .pci_ops = _root_ops,
+   .prepare = pci_host_bridge_prepare,
+};
+
 struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 {
struct acpi_device *device = root->device;
@@ -428,7 +441,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root 
*root)
struct pci_controller *controller;
struct pci_root_info *info = NULL;
int busnum = root->secondary.start;
-   struct pci_bus *pbus;
+   struct pci_host_bridge *host;
int ret;
 
controller = alloc_pci_controller(domain);
@@ -465,26 +478,17 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root 
*root)
 * should handle the case here, but it appears that IA64 hasn't
 * such quirk. So we just ignore the case now.
 */
-   pbus = pci_create_root_bus(NULL, domain, bus, _root_ops,
-   controller, >resources);
-   if (!pbus) {
+   host = pci_scan_host_bridge(NULL, domain, bus, controller,
+   >resources, _host_ops);
+   if (!host) {
pci_free_resource_list(>resources);
__release_pci_root_info(info);
return NULL;
}
 
-   pci_set_host_bridge_release(to_pci_host_bridge(pbus->bridge),
+   pci_set_host_bridge_release(host,
release_pci_root_info, info);
-   pci_scan_child_bus(pbus);
-   return pbus;
-}
-
-int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
-{
-   struct pci_controller *controller = bridge->bus->sysdata;
-
-   ACPI_COMPANION_SET(>dev, controller->companion);
-   return 0;
+   return host->bus;
 }
 
 void pcibios_fixup_device_resources(struct pci_dev *dev)
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 14/30] PCI: Introduce pci_host_bridge_ops to support host specific operations

2015-03-23 Thread Yijing Wang
Now we have weak functions like pcibios_root_bridge_prepare()
to setup pci host bridge, We could introduce pci_host_bridge_ops
which contain host bridge specific ops to setup pci_host_bridge.
Then host bridge driver could add pci_host_bridge_ops hooks
intead of weak function to setup pci_host_bridge.
This patch add following pci_host_bridge_ops hooks:

pci_host_bridge_ops {
struct pci_ops *ops;
/* set root bus speed, some platform need this like powerpc */
void (*set_root_bus_speed)(struct pci_host_bridge *host);
/* setup pci_host_bridge before pci_host_bridge be added to driver core 
*/
int (*prepare)(struct pci_host_bridge *host);
/* platform specific of scan hook to scan pci device */
int (*scan_bus)(struct pci_host_bridge *);
}
We could easily extend it to support different host bridge
specific operations.

Signed-off-by: Yijing Wang 
---
 drivers/pci/host-bridge.c |9 -
 drivers/pci/pci.h |5 +++--
 drivers/pci/probe.c   |   11 ---
 include/linux/pci.h   |9 +
 4 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index 87c4fc5..b439264 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -63,7 +63,8 @@ static bool pci_host_busn_res_overlap(
 
 struct pci_host_bridge *pci_create_host_bridge(
struct device *parent, int domain, int bus,
-   void *sysdata, struct list_head *resources)
+   void *sysdata, struct list_head *resources,
+   struct pci_host_bridge_ops *ops)
 {
int error;
struct pci_host_bridge *host, *tmp;
@@ -98,10 +99,16 @@ struct pci_host_bridge *pci_create_host_bridge(
list_add_tail(>list, _host_bridge_list);
mutex_unlock(_host_mutex);
 
+   host->ops = ops;
host->dev.release = pci_release_host_bridge_dev;
dev_set_drvdata(>dev, sysdata);
dev_set_name(>dev, "pci%04x:%02x",
host->domain, bus);
+   if (host->ops && host->ops->prepare) {
+   error = host->ops->prepare(host);
+   if (error)
+   goto list_del;
+   }
 
error = pcibios_root_bridge_prepare(host);
if (error)
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 027fba0..ef10cc1 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -334,8 +334,9 @@ static inline void pci_host_assign_domain_nr(struct 
pci_host_bridge *host)
 }
 #endif
 
-struct pci_host_bridge *pci_create_host_bridge(struct device *parent,
-int domain, int bus, void *sysdata, struct list_head *resources);
+struct pci_host_bridge *pci_create_host_bridge(
+   struct device *parent, int domain, int bus, void *sysdata,
+   struct list_head *resources, struct pci_host_bridge_ops *ops);
 void pci_free_host_bridge(struct pci_host_bridge *host);
 
 static inline int pci_host_first_busnr(struct pci_host_bridge *host)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index ee17d9a..36dfee0 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1894,6 +1894,8 @@ static struct pci_bus *__pci_create_root_bus(
bridge->bus = b;
b->bridge = get_device(>dev);
 
+   if (bridge->ops && bridge->ops->set_root_bus_speed)
+   bridge->ops->set_root_bus_speed(bridge);
pcibios_set_root_bus_speed(bridge);
device_enable_async_suspend(b->bridge);
pci_set_bus_of_node(b);
@@ -1958,7 +1960,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent,
struct pci_host_bridge *host;
 
host = pci_create_host_bridge(parent, domain, bus,
-   sysdata, resources);
+   sysdata, resources, NULL);
if (!host)
return NULL;
 
@@ -2048,7 +2050,10 @@ static struct pci_bus *__pci_scan_root_bus(
if (!b)
return NULL;
 
-   max = pci_scan_child_bus(b);
+   if (host->ops && host->ops->scan_bus)
+   max = host->ops->scan_bus(host);
+   else
+   max = pci_scan_child_bus(b);
 
/* If default busn resource used, update the max bus number */
if (host->busn_res.flags & IORESOURCE_BUS) {
@@ -2066,7 +2071,7 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, 
int domain,
struct pci_host_bridge *host;
 
host = pci_create_host_bridge(parent, domain, bus,
-   sysdata, resources);
+   sysdata, resources, NULL);
if (!host)
return NULL;
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 91cba01..2702a51 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -400,6 +400,14 @@ static inline int pci_channel_offline(struct pci_dev *pdev)
return (pdev->error_state != pci_channel_io_normal);
 }
 
+struct pci_host_bridge;
+struct pci_host_bridge_ops {
+   struct pci_ops 

[PATCH v8 03/30] PCI: Save domain in pci_host_bridge

2015-03-23 Thread Yijing Wang
Save domain in pci_host_bridge, so we could get domain
from pci_host_bridge, and at the end of series, we could
clean up the arch specific pci_domain_nr(). For arm,
we pass -1 as the domain number, we would update the
domain number in core by pci_bus_assign_domain_nr().

Signed-off-by: Yijing Wang 
---
 arch/alpha/kernel/pci.c|4 ++--
 arch/alpha/kernel/sys_nautilus.c   |2 +-
 arch/arm/kernel/bios32.c   |2 +-
 arch/arm/mach-dove/pcie.c  |2 +-
 arch/arm/mach-iop13xx/pci.c|4 ++--
 arch/arm/mach-mv78xx0/pcie.c   |2 +-
 arch/arm/mach-orion5x/pci.c|4 ++--
 arch/frv/mb93090-mb00/pci-vdk.c|3 ++-
 arch/ia64/pci/pci.c|4 ++--
 arch/ia64/sn/kernel/io_init.c  |4 ++--
 arch/m68k/coldfire/pci.c   |2 +-
 arch/microblaze/pci/pci-common.c   |4 ++--
 arch/mips/pci/pci.c|4 ++--
 arch/mn10300/unit-asb2305/pci.c|3 ++-
 arch/powerpc/kernel/pci-common.c   |4 ++--
 arch/s390/pci/pci.c|4 ++--
 arch/sh/drivers/pci/pci.c  |4 ++--
 arch/sparc/kernel/leon_pci.c   |2 +-
 arch/sparc/kernel/pci.c|4 ++--
 arch/sparc/kernel/pcic.c   |2 +-
 arch/tile/kernel/pci.c |4 ++--
 arch/tile/kernel/pci_gx.c  |4 ++--
 arch/unicore32/kernel/pci.c|2 +-
 arch/x86/pci/acpi.c|4 ++--
 arch/x86/pci/common.c  |2 +-
 arch/xtensa/kernel/pci.c   |2 +-
 drivers/parisc/dino.c  |2 +-
 drivers/parisc/lba_pci.c   |2 +-
 drivers/pci/host/pci-mvebu.c   |2 +-
 drivers/pci/host/pci-tegra.c   |4 ++--
 drivers/pci/host/pci-versatile.c   |3 ++-
 drivers/pci/host/pci-xgene.c   |2 +-
 drivers/pci/host/pcie-designware.c |2 +-
 drivers/pci/host/pcie-xilinx.c |2 +-
 drivers/pci/hotplug/ibmphp_core.c  |2 +-
 drivers/pci/probe.c|   21 +
 drivers/pci/xen-pcifront.c |2 +-
 include/linux/pci.h|8 +---
 38 files changed, 72 insertions(+), 62 deletions(-)

diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 82f738e..2b0bce9 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -336,8 +336,8 @@ common_init_pci(void)
pci_add_resource_offset(, hose->mem_space,
hose->mem_space->start);
 
-   bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops,
-   hose, );
+   bus = pci_scan_root_bus(NULL, hose->index, next_busno,
+   alpha_mv.pci_ops, hose, );
if (!bus)
continue;
hose->bus = bus;
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 700686d..9614e4e 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -206,7 +206,7 @@ nautilus_init_pci(void)
unsigned long memtop = max_low_pfn << PAGE_SHIFT;
 
/* Scan our single hose.  */
-   bus = pci_scan_bus(0, alpha_mv.pci_ops, hose);
+   bus = pci_scan_bus(hose->index, 0, alpha_mv.pci_ops, hose);
if (!bus)
return;
 
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index ab19b7c..fec2c90 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -486,7 +486,7 @@ static void pcibios_init_hw(struct device *parent, struct 
hw_pci *hw,
if (hw->scan)
sys->bus = hw->scan(nr, sys);
else
-   sys->bus = pci_scan_root_bus(parent, sys->busnr,
+   sys->bus = pci_scan_root_bus(parent, -1, 
sys->busnr,
hw->ops, sys, >resources);
 
if (!sys->bus)
diff --git a/arch/arm/mach-dove/pcie.c b/arch/arm/mach-dove/pcie.c
index 91fe971..a379287 100644
--- a/arch/arm/mach-dove/pcie.c
+++ b/arch/arm/mach-dove/pcie.c
@@ -160,7 +160,7 @@ dove_pcie_scan_bus(int nr, struct pci_sys_data *sys)
return NULL;
}
 
-   return pci_scan_root_bus(NULL, sys->busnr, _ops, sys,
+   return pci_scan_root_bus(NULL, -1, sys->busnr, _ops, sys,
 >resources);
 }
 
diff --git a/arch/arm/mach-iop13xx/pci.c b/arch/arm/mach-iop13xx/pci.c
index 9082b84..bc4ba7e 100644
--- a/arch/arm/mach-iop13xx/pci.c
+++ b/arch/arm/mach-iop13xx/pci.c
@@ -535,12 +535,12 @@ struct pci_bus *iop13xx_scan_bus(int nr, struct 
pci_sys_data *sys)
while(time_before(jiffies, atux_trhfa_timeout))
udelay(100);
 
-   bus = pci_bus_atux = pci_scan_root_bus(NULL, sys->busnr,
+   bus = pci_bus_atux = pci_scan_root_bus(NULL, -1, sys->busnr,
   

[PATCH v8 16/30] PCI: Introduce pci_bus_child_max_busnr()

2015-03-23 Thread Yijing Wang
Sometimes, we want to know the highest reserved
busnr for children bus. Because parent's bus->busn_res
may have padding in it. For example, some host drivers
don't know the bus end, so they supply the bus
resource (root_bus, 255), they want to update the
max bus number after pci scan complete. But pci scan
functions won't return the actual max bus number.
So we could use pci_bus_child_max_busnr() to find
that.

Signed-off-by: Fengguang Wu 
Signed-off-by: Yijing Wang 
---
 drivers/pci/hotplug/acpiphp_glue.c |   29 +
 drivers/pci/pci.c  |   27 +--
 include/linux/pci.h|2 +-
 3 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/drivers/pci/hotplug/acpiphp_glue.c 
b/drivers/pci/hotplug/acpiphp_glue.c
index bcb90e4..84f2584 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -397,33 +397,6 @@ static void cleanup_bridge(struct acpiphp_bridge *bridge)
acpi_unlock_hp_context();
 }
 
-/**
- * acpiphp_max_busnr - return the highest reserved bus number under the given 
bus.
- * @bus: bus to start search with
- */
-static unsigned char acpiphp_max_busnr(struct pci_bus *bus)
-{
-   struct pci_bus *tmp;
-   unsigned char max, n;
-
-   /*
-* pci_bus_max_busnr will return the highest
-* reserved busnr for all these children.
-* that is equivalent to the bus->subordinate
-* value.  We don't want to use the parent's
-* bus->subordinate value because it could have
-* padding in it.
-*/
-   max = bus->busn_res.start;
-
-   list_for_each_entry(tmp, >children, node) {
-   n = pci_bus_max_busnr(tmp);
-   if (n > max)
-   max = n;
-   }
-   return max;
-}
-
 static void acpiphp_set_acpi_region(struct acpiphp_slot *slot)
 {
struct acpiphp_func *func;
@@ -489,7 +462,7 @@ static void enable_slot(struct acpiphp_slot *slot)
LIST_HEAD(add_list);
 
acpiphp_rescan_slot(slot);
-   max = acpiphp_max_busnr(bus);
+   max = pci_bus_child_max_busnr(bus);
for (pass = 0; pass < 2; pass++) {
list_for_each_entry(dev, >devices, bus_list) {
if (PCI_SLOT(dev->devfn) != slot->device)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 6677fac..8a2f12c 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -108,7 +108,7 @@ static bool pcie_ari_disabled;
  * Given a PCI bus, returns the highest PCI bus number present in the set
  * including the given PCI bus and its list of child PCI buses.
  */
-unsigned char pci_bus_max_busnr(struct pci_bus *bus)
+static unsigned char pci_bus_max_busnr(struct pci_bus *bus)
 {
struct pci_bus *tmp;
unsigned char max, n;
@@ -121,7 +121,30 @@ unsigned char pci_bus_max_busnr(struct pci_bus *bus)
}
return max;
 }
-EXPORT_SYMBOL_GPL(pci_bus_max_busnr);
+
+unsigned char pci_bus_child_max_busnr(struct pci_bus *bus)
+{
+   struct pci_bus *tmp;
+   unsigned char max, n;
+
+   /*
+* pci_bus_max_busnr will return the highest
+* reserved busnr for all these children.
+* that is equivalent to the bus->subordinate
+* value.  We don't want to use the parent's
+* bus->subordinate value because it could have
+* padding in it.
+*/
+   max = bus->busn_res.start;
+
+   list_for_each_entry(tmp, >children, node) {
+   n = pci_bus_max_busnr(tmp);
+   if (n > max)
+   max = n;
+   }
+   return max;
+}
+EXPORT_SYMBOL_GPL(pci_bus_child_max_busnr);
 
 #ifdef CONFIG_HAS_IOMEM
 void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 7f4f182..0b921d6 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1185,7 +1185,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev 
*dev, int max,
 void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *),
  void *userdata);
 int pci_cfg_space_size(struct pci_dev *dev);
-unsigned char pci_bus_max_busnr(struct pci_bus *bus);
+unsigned char pci_bus_child_max_busnr(struct pci_bus *bus);
 void pci_setup_bridge(struct pci_bus *bus);
 resource_size_t pcibios_window_alignment(struct pci_bus *bus,
 unsigned long type);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 01/30] xen/PCI: Don't use deprecated function pci_scan_bus_parented()

2015-03-23 Thread Yijing Wang
From: Arnd Bergmann 

Use pci_scan_root_bus() instead of deprecated function
pci_scan_bus_parented().

Signed-off-by: Arnd Bergmann 
Signed-off-by: Yijing Wang 
CC: Konrad Rzeszutek Wilk 
CC: xen-de...@lists.xenproject.org
---
 drivers/pci/xen-pcifront.c |   16 +---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index b1ffebe..a69e529 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -446,9 +446,15 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 unsigned int domain, unsigned int bus)
 {
struct pci_bus *b;
+   LIST_HEAD(resources);
struct pcifront_sd *sd = NULL;
struct pci_bus_entry *bus_entry = NULL;
int err = 0;
+   static struct resource busn_res = {
+   .start = 0,
+   .end = 255,
+   .flags = IORESOURCE_BUS,
+   };
 
 #ifndef CONFIG_PCI_DOMAINS
if (domain != 0) {
@@ -470,17 +476,21 @@ static int pcifront_scan_root(struct pcifront_device 
*pdev,
err = -ENOMEM;
goto err_out;
}
+   pci_add_resource(, _resource);
+   pci_add_resource(, _resource);
+   pci_add_resource(, _res);
pcifront_init_sd(sd, domain, bus, pdev);
 
pci_lock_rescan_remove();
 
-   b = pci_scan_bus_parented(>xdev->dev, bus,
- _bus_ops, sd);
+   b = pci_scan_root_bus(>xdev->dev, bus,
+ _bus_ops, sd, );
if (!b) {
dev_err(>xdev->dev,
"Error creating PCI Frontend Bus!\n");
err = -ENOMEM;
pci_unlock_rescan_remove();
+   pci_free_resource_list();
goto err_out;
}
 
@@ -488,7 +498,7 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
 
list_add(_entry->list, >root_buses);
 
-   /* pci_scan_bus_parented skips devices which do not have a have
+   /* pci_scan_root_bus skips devices which do not have a
* devfn==0. The pcifront_scan_bus enumerates all devfn. */
err = pcifront_scan_bus(pdev, domain, bus, b);
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Re: [PATCH v2] kernel/panic/kexec: fix "crash_kexec_post_notifiers" option issue in oops path

2015-03-23 Thread Masami Hiramatsu
(2015/03/23 16:19), Ingo Molnar wrote:
> 
> * Baoquan He  wrote:
> 
>> CC more people ...
>>
>> On 03/07/15 at 01:31am, "Hatayama, Daisuke/畑山 大輔" wrote:
>>> The commit f06e5153f4ae2e2f3b0300f0e260e40cb7fefd45 introduced
>>> "crash_kexec_post_notifiers" kernel boot option, which toggles
>>> wheather panic() calls crash_kexec() before panic_notifiers and dump
>>> kmsg or after.
>>>
>>> The problem is that the commit overlooks panic_on_oops kernel boot
>>> option. If it is enabled, crash_kexec() is called directly without
>>> going through panic() in oops path.
>>>
>>> To fix this issue, this patch adds a check to
>>> "crash_kexec_post_notifiers" in the condition of kexec_should_crash().
>>>
>>> Also, put a comment in kexec_should_crash() to explain not obvious
>>> things on this patch.
>>>
>>> Signed-off-by: HATAYAMA Daisuke 
>>> Acked-by: Baoquan He 
>>> Tested-by: Hidehiro Kawai 
>>> Reviewed-by: Masami Hiramatsu 
>>> ---
>>>  include/linux/kernel.h |  3 +++
>>>  kernel/kexec.c | 11 +++
>>>  kernel/panic.c |  2 +-
>>>  3 files changed, 15 insertions(+), 1 deletion(-)
> 
> This is hack upon hack, but why was this crap merged in the first 
> place?
> 
> I see two problems just by cursory review:
> 
> 1)
> 
> Firstly, the real bug in:
> 
>   f06e5153f4ae ("kernel/panic.c: add "crash_kexec_post_notifiers" option for 
> kdump after panic_notifers")
> 
> Was that crash_kexec() was called unconditionally after notifiers were 
> called, which should be fixed via the simple patch below (untested). 
> Looks much simpler than your fix.

No, Daisuke's patch is not for that case. Since the kdump has a special hook in
kernel oops, when both of panic_on_oops and crash_kernel are set, panic() is
never called. Please see oops_end@arch/x86/kernel/dumpstack.c


void oops_end(unsigned long flags, struct pt_regs *regs, int signr)
{
if (regs && kexec_should_crash(current))
crash_kexec(regs);

Of course crash_kexec() never return except failing kexec unexpectedly.

Thus, kexec_should_crash should returns 0 if crash_kexec_post_notifiers is set.
(Semantically, it is a bit strange that panic_on_oops doesn't call panic(), but
that is another topic.)

However, your patch is also needed since the first crash_kexec() can fail in 
panic()
when crash_kexec_post_notifiers is not set. In that case, kernel tries to call
notifiers and call the 2nd crash_kexec() again. Actually the 2nd one is useless.

So, here is my reviewed-by.

Reviewed-by: Masami Hiramatsu 

I'll be reply the latter part in other mail.

Thank you,

> 
> 2)
> 
> Secondly, and more importantly, the whole premise of commit 
> f06e5153f4ae is broken IMHO:
> 
>  "This can help rare situations where kdump fails because of unstable
>   crashed kernel or hardware failure (memory corruption on critical
>   data/code)"
> 
> wtf?
> 
> If the kernel crashed due to a kernel crash, then the kernel booting 
> up in whatever hardware state should be able to do a clean bootup. The 
> fix for those 'rare situations' should be to fix the real bug (for 
> example by making hardware driver init (or deinit) sequences more 
> robust), not to paper it over by ordering around crash-time sequences 
> ...
> 
> If it crashed due to some hardware failure, there's literally an 
> infinite amount of failure modes that may or may not be impacted by 
> kexec crash-time handling ordering. We don't want to put a zillion 
> such flags into the kernel proper just to allow the perturbation of 
> the kernel.
> 
> Thanks,
> 
>   Ingo
> 
> diff --git a/kernel/panic.c b/kernel/panic.c
> index 8136ad76e5fd..774614f72cbd 100644
> --- a/kernel/panic.c
> +++ b/kernel/panic.c
> @@ -142,7 +142,8 @@ void panic(const char *fmt, ...)
>* Note: since some panic_notifiers can make crashed kernel
>* more unstable, it can increase risks of the kdump failure too.
>*/
> - crash_kexec(NULL);
> + if (crash_kexec_post_notifiers)
> + crash_kexec(NULL);
>  
>   bust_spinlocks(0);
>  
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 


-- 
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu...@hitachi.com


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: linux-next: build failure after merge of the vfs tree

2015-03-23 Thread Stephen Rothwell
Hi Al,

On Fri, 13 Mar 2015 12:02:50 +1100 Stephen Rothwell  
wrote:
>
> After merging the vfs tree, today's linux-next build (arm
> multi_v7_defconfig) failed like this:
> 
> fs/ext4/indirect.c: In function 'ext4_ind_direct_IO':
> fs/ext4/indirect.c:653:2: error: implicit declaration of function 
> 'iov_iter_count' [-Werror=implicit-function-declaration]
>   size_t count = iov_iter_count(iter);
>   ^
> 
> Caused by commit 3737c63e1fb0 ("fs: move struct kiocb to fs.h").  aio.h
> used to include uio.h ...
> 
> I wonder if there is more fallout from this include file diet.
> 
> It would have been nice if the more general changes to aio.h were in a
> separate patch.
> 
> I added the following patch for today:
> 
> From: Stephen Rothwell 
> Date: Fri, 13 Mar 2015 11:56:46 +1100
> Subject: [PATCH] ext4: iov_iter_count needs linux/uio.h
> 
> Fixes: 3737c63e1fb0 ("fs: move struct kiocb to fs.h")
> Signed-off-by: Stephen Rothwell 
> ---
>  fs/ext4/indirect.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c
> index 33308738a06a..a9369e5d2cc1 100644
> --- a/fs/ext4/indirect.c
> +++ b/fs/ext4/indirect.c
> @@ -20,6 +20,8 @@
>   *   (s...@redhat.com), 1993, 1998
>   */
>  
> +#include 
> +
>  #include "ext4_jbd2.h"
>  #include "truncate.h"
>  
> -- 
> 2.1.4

I am still applying the above patch every day ...
-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


pgp4wKKKMUsYs.pgp
Description: OpenPGP digital signature


Re: Fund Release Notification $10.5 Million USD

2015-03-23 Thread Mr. Henly Anderson Delany
Good day!

Re: Fund Release Notification $10.5 Million USD

Please be informed that we have received a notification for the
release and transfer of your sum We are the Financial
consultants/Bendigo Bank Australia. This Bank which we represent in
the Australia has directed us to process the release and transfer of
this fund to your designated account. Hence, your payment file has
been dispatched to our office to enable us process the release and
transfer of your fund to your designated account.

All arrangements for the release and transfer of this fund are being
made presently. However, in line with the international standard
practice of banking (treasure management support directives) I have
the pleasure to formally confirm the final credit control approval in
favor of the above named beneficiary through our wire/telegraphic
transfer services.

However for correctness and effectiveness of the pending credit, the
risk control office has proceeded with the mandatory reconciliation,
re-routing and prompt re-validation of the pending credit records as
in-putted in the system database to ensure appropriateness. Upon
conclusion on the foregoing shall immediately forward the payment
confirmation code to our accredited foreign correspondence bank abroad
to wire the fund to your bank account.

Below are the requirements needed from you to facilitate release of
your funds. Your account details where the payment will be wired into
through our correspondence bank abroad via your corresponding bank.

Your personal profile (Profession, age, telephone number and full address)
The Name of the Bank
The account details will comprise the full address of the bank.
The phone and fax number of the Bank
The Routing number/Swift code/ABA number of your bank
Account name and Account number.

Please confirm your bank account details as stated above. This will
enable us to conclude with the processing of your fund in your favor.
Your identification, driver’s license or International passport,
preferable International passport.

We can assure you that we shall do our best to ensure that this fund
is released to you soonest if you are able to follow our instructions
promptly. Please note that we can finalize with the release and
transfer of your fund soonest if you are able to follow our
instructions carefully.

Your urgent response is required soonest.

Thank you for the understanding.
Best Regards.
Mr. Henly Anderson Delany
E-mail: carecusto...@pisem.net
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] nfsd: incorrect check for debugfs returns

2015-03-23 Thread Chengyu Song
debugfs_create_dir and debugfs_create_file may return -ENODEV when debugfs
is not configured, so the return value should be checked against ERROR_VALUE
as well, otherwise the later dereference of the dentry pointer would crash
the kernel.

Signed-off-by: Chengyu Song 
---
 fs/nfsd/fault_inject.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/fs/nfsd/fault_inject.c b/fs/nfsd/fault_inject.c
index c16bf5a..621d065 100644
--- a/fs/nfsd/fault_inject.c
+++ b/fs/nfsd/fault_inject.c
@@ -132,19 +132,23 @@ int nfsd_fault_inject_init(void)
unsigned int i;
struct nfsd_fault_inject_op *op;
umode_t mode = S_IFREG | S_IRUSR | S_IWUSR;
+   struct dentry *dent;
 
-   debug_dir = debugfs_create_dir("nfsd", NULL);
-   if (!debug_dir)
+   dent = debugfs_create_dir("nfsd", NULL);
+   if (IS_ERR_OR_NULL(dent))
goto fail;
+   debug_dir = dent;
 
for (i = 0; i < NUM_INJECT_OPS; i++) {
op = _ops[i];
-   if (!debugfs_create_file(op->file, mode, debug_dir, op, 
_nfsd))
+   dent = debugfs_create_file(op->file, mode, debug_dir, op, 
_nfsd);
+   if (IS_ERR_OR_NULL(dent))
goto fail;
+
}
return 0;
 
 fail:
nfsd_fault_inject_cleanup();
-   return -ENOMEM;
+   return dent ? PTR_ERR(dent) : -ENOMEM;
 }
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: linux-next: build failure after merge of the net-next tree

2015-03-23 Thread David Miller
From: Stephen Rothwell 
Date: Tue, 24 Mar 2015 13:45:08 +1100

> After merging the net-next tree, today's linux-next build (x86_64
> allmodconfig) failed like this:
> 
> crypto/algif_skcipher.c: In function 'skcipher_async_cb':
> crypto/algif_skcipher.c:109:2: error: implicit declaration of function 
> 'aio_complete' [-Werror=implicit-function-declaration]
>   aio_complete(iocb, err, err);
>   ^
> 
> Caused by commit a596999b7ddf ("crypto: algif - change algif_skcipher
> to be asynchronous") interacting with commit 04b2fa9f8f36 ("fs: split
> generic and aio kiocb") from the vfs tree.
> 
> I applied the following merge fix patch (which gets it building, but I
> am not sure if more is needed).

Ok, more conflicts wiht Al's vfs work.

This is starting to pile on, heavily...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Bugfix] x86/PCI/ACPI: Fix regression caused by commit 63f1789ec716

2015-03-23 Thread Jiang Liu
On 2015/3/24 10:42, Bjorn Helgaas wrote:
> On Mon, Mar 23, 2015 at 9:22 PM, Jiang Liu  wrote:
>> On 2015/3/24 0:48, Bjorn Helgaas wrote:
>>> On Mon, Mar 23, 2015 at 03:22:14PM +0800, Jiang Liu wrote:
 Commit 63f1789ec716("Ignore resources consumed by host bridge itself")
 tries to ignore resources consumed by PCI host bridge itself by
 checking IORESOURCE_WINDOW flag, which causes regression on some
 platforms.
>>>
>>> "Do.  Or do not.  There is no try."
>>> [http://www.starwars.com/video/do-or-do-not]
>>>
>>> That commit doesn't *try* to do something.  It *does* something.  Just
>>> explain what it does and what's wrong with what it does.
>>>
 For example, PC Engines APU.1C platform defines PCI MMIO resources with
 ACPI Memory32Fixed operator as below:
 Name (CRES, ResourceTemplate ()
 {
 ...
 WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode,
 0x, // Granularity
 0x0D00, // Range Minimum
 0x, // Range Maximum
 0x, // Translation Offset
 0xF300, // Length
 ,, , TypeStatic)
 Memory32Fixed (ReadOnly,
 0x000A, // Address Base
 0x0002, // Address Length
 )
 Memory32Fixed (ReadOnly,
 0x, // Address Base
 0x, // Address Length
 _Y00)
 })

 Memory32Fixed operator doesn't support concept of "producer/consumer"
 and it will be treated as "consumer" by the ACPI resource parsing
 interface, thus cause regression. So the fix is only to check
 "producer/consumer" flag for resources having "producer/consumer" flag.
>>>
>>> Apparently the problem is with the Memory32Fixed resources above; it sounds
>>> like we ignore them after 63f1789ec716?  I don't quite understand how this
>>> fix works.  acpi_dev_filter_resource_type() has cases for both
>>> ACPI_RESOURCE_TYPE_FIXED_MEMORY32 and ACPI_RESOURCE_TYPE_ADDRESSxx, but
>>> this patch only touches the latter, not the
>>> ACPI_RESOURCE_TYPE_FIXED_MEMORY32 case.
>> The idea is:
>> 1) caller specifies IORESOURCE_WINDOW to query resources provided
>>by the device, otherwise it's querying resources consumed by
>>the device.
>> 2) For resource descriptors having producer/consumer flag, such as
>> ACPI_RESOURCE_TYPE_ADDRESSxx, we check the producer/consumer flag.
>> 3) For resource descriptors not having producer/consumer flag, such
>>as ACPI_RESOURCE_TYPE_FIXED_MEMORY32, we skip checking the
>>producer/consumer flag.
> 
> I figured out that much by reading the code.  But I think the code is
> very hard to read, and I still don't really understand how it works.
> 
> Before this fix, we ignore Memory32Fixed resources.  After this fix,
> we use Memory32Fixed as a window.  I think that's an incorrect
> interpretation of Memory32Fixed.
Hi Bjorn,
I think it's illegal to use Memory32Fixed for PCI host
bridge resource window too. The fix is to solve the regression
by relaxing constraints, but that may not be the right solution.
How about waiting for a while to see whether there are more
bug reports related to this. If only limited platform affected,
we could treat it as BIOS bugs and use quirk to handle it.
Otherwise we may need to relax the constraint.
Thanks!
Gerry
> 
>>> Is it even legal to use Memory32Fixed for a bridge window?  Is this just a
>>> BIOS bug?  If so, how do we know this workaround won't break something
>>> else for BIOSes that use Memory32Fixed correctly?
>>>
>>> Should this be a BIOS-specific quirk?
>> I have searched ACPI spec 5.0 and PCI firmware spec 3.1, but haven't
>> found any statement tells whether Memory32Fixed could be used for
>> PCI host bridge resources yet. So to be honest, I'm not sure it's
>> legal or illegal:(
> 
> I think it could certainly be used for host bridge register space, if
> the bridge supplied a _HID that a device-specific driver could claim.
> But I think a generic driver like pci_root.c has to rely on the
> producer/consumer bit to differentiate windows ("produced" space) from
> device registers ("consumed" space), so I think Memory32Fixed for a
> window makes no sense.
> 
>>> It'd be nice to have Bernhard's logs archived somewhere and referenced
>>> here.  This seems like a dusty corner of the code that might have to be
>>> revisited someday.
>> I have archived the acpidump at:
>> https://bugzilla.kernel.org/show_bug.cgi?id=94221
> 
> Yes, I noticed that.  Unfortunately, there is no link to the bugzilla
> in your changelog.
> 
 --- a/arch/x86/pci/acpi.c
 +++ b/arch/x86/pci/acpi.c
 @@ -337,7 +337,7 @@ static void probe_pci_root_info(struct pci_root_info 
 *info,
  info->bridge = device;
  ret = acpi_dev_get_resources(device, list,
   acpi_dev_filter_resource_type_cb,
 -   

linux-next: build failure after merge of the net-next tree

2015-03-23 Thread Stephen Rothwell
Hi all,

After merging the net-next tree, today's linux-next build (x86_64
allmodconfig) failed like this:

crypto/algif_skcipher.c: In function 'skcipher_async_cb':
crypto/algif_skcipher.c:109:2: error: implicit declaration of function 
'aio_complete' [-Werror=implicit-function-declaration]
  aio_complete(iocb, err, err);
  ^

Caused by commit a596999b7ddf ("crypto: algif - change algif_skcipher
to be asynchronous") interacting with commit 04b2fa9f8f36 ("fs: split
generic and aio kiocb") from the vfs tree.

I applied the following merge fix patch (which gets it building, but I
am not sure if more is needed).

From: Stephen Rothwell 
Date: Tue, 24 Mar 2015 13:40:45 +1100
Subject: [PATCH] crypto: algif - cope with aio_complete() going away

Signed-off-by: Stephen Rothwell 
---
 crypto/algif_skcipher.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c
index 8276f21ea7be..506eb5f62b03 100644
--- a/crypto/algif_skcipher.c
+++ b/crypto/algif_skcipher.c
@@ -106,7 +106,7 @@ static void skcipher_async_cb(struct crypto_async_request 
*req, int err)
atomic_dec(>inflight);
skcipher_free_async_sgls(sreq);
kfree(req);
-   aio_complete(iocb, err, err);
+   iocb->ki_complete(iocb, err, err);
 }
 
 static inline int skcipher_sndbuf(struct sock *sk)
-- 
2.1.4

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


pgpKWJu2tkT87.pgp
Description: OpenPGP digital signature


Re: [Bugfix] x86/PCI/ACPI: Fix regression caused by commit 63f1789ec716

2015-03-23 Thread Bjorn Helgaas
On Mon, Mar 23, 2015 at 9:22 PM, Jiang Liu  wrote:
> On 2015/3/24 0:48, Bjorn Helgaas wrote:
>> On Mon, Mar 23, 2015 at 03:22:14PM +0800, Jiang Liu wrote:
>>> Commit 63f1789ec716("Ignore resources consumed by host bridge itself")
>>> tries to ignore resources consumed by PCI host bridge itself by
>>> checking IORESOURCE_WINDOW flag, which causes regression on some
>>> platforms.
>>
>> "Do.  Or do not.  There is no try."
>> [http://www.starwars.com/video/do-or-do-not]
>>
>> That commit doesn't *try* to do something.  It *does* something.  Just
>> explain what it does and what's wrong with what it does.
>>
>>> For example, PC Engines APU.1C platform defines PCI MMIO resources with
>>> ACPI Memory32Fixed operator as below:
>>> Name (CRES, ResourceTemplate ()
>>> {
>>> ...
>>> WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode,
>>> 0x, // Granularity
>>> 0x0D00, // Range Minimum
>>> 0x, // Range Maximum
>>> 0x, // Translation Offset
>>> 0xF300, // Length
>>> ,, , TypeStatic)
>>> Memory32Fixed (ReadOnly,
>>> 0x000A, // Address Base
>>> 0x0002, // Address Length
>>> )
>>> Memory32Fixed (ReadOnly,
>>> 0x, // Address Base
>>> 0x, // Address Length
>>> _Y00)
>>> })
>>>
>>> Memory32Fixed operator doesn't support concept of "producer/consumer"
>>> and it will be treated as "consumer" by the ACPI resource parsing
>>> interface, thus cause regression. So the fix is only to check
>>> "producer/consumer" flag for resources having "producer/consumer" flag.
>>
>> Apparently the problem is with the Memory32Fixed resources above; it sounds
>> like we ignore them after 63f1789ec716?  I don't quite understand how this
>> fix works.  acpi_dev_filter_resource_type() has cases for both
>> ACPI_RESOURCE_TYPE_FIXED_MEMORY32 and ACPI_RESOURCE_TYPE_ADDRESSxx, but
>> this patch only touches the latter, not the
>> ACPI_RESOURCE_TYPE_FIXED_MEMORY32 case.
> The idea is:
> 1) caller specifies IORESOURCE_WINDOW to query resources provided
>by the device, otherwise it's querying resources consumed by
>the device.
> 2) For resource descriptors having producer/consumer flag, such as
> ACPI_RESOURCE_TYPE_ADDRESSxx, we check the producer/consumer flag.
> 3) For resource descriptors not having producer/consumer flag, such
>as ACPI_RESOURCE_TYPE_FIXED_MEMORY32, we skip checking the
>producer/consumer flag.

I figured out that much by reading the code.  But I think the code is
very hard to read, and I still don't really understand how it works.

Before this fix, we ignore Memory32Fixed resources.  After this fix,
we use Memory32Fixed as a window.  I think that's an incorrect
interpretation of Memory32Fixed.

>> Is it even legal to use Memory32Fixed for a bridge window?  Is this just a
>> BIOS bug?  If so, how do we know this workaround won't break something
>> else for BIOSes that use Memory32Fixed correctly?
>>
>> Should this be a BIOS-specific quirk?
> I have searched ACPI spec 5.0 and PCI firmware spec 3.1, but haven't
> found any statement tells whether Memory32Fixed could be used for
> PCI host bridge resources yet. So to be honest, I'm not sure it's
> legal or illegal:(

I think it could certainly be used for host bridge register space, if
the bridge supplied a _HID that a device-specific driver could claim.
But I think a generic driver like pci_root.c has to rely on the
producer/consumer bit to differentiate windows ("produced" space) from
device registers ("consumed" space), so I think Memory32Fixed for a
window makes no sense.

>> It'd be nice to have Bernhard's logs archived somewhere and referenced
>> here.  This seems like a dusty corner of the code that might have to be
>> revisited someday.
> I have archived the acpidump at:
> https://bugzilla.kernel.org/show_bug.cgi?id=94221

Yes, I noticed that.  Unfortunately, there is no link to the bugzilla
in your changelog.

>>> --- a/arch/x86/pci/acpi.c
>>> +++ b/arch/x86/pci/acpi.c
>>> @@ -337,7 +337,7 @@ static void probe_pci_root_info(struct pci_root_info 
>>> *info,
>>>  info->bridge = device;
>>>  ret = acpi_dev_get_resources(device, list,
>>>   acpi_dev_filter_resource_type_cb,
>>> - (void *)(IORESOURCE_IO | IORESOURCE_MEM));
>>> + (void *)(IORESOURCE_IO | IORESOURCE_MEM | 
>>> IORESOURCE_WINDOW));
>>
>> Tangent: I'm disappointed that ia64 didn't get reworked to track the x86
>> code here.  Is that coming soon?
> I have checked IA64 when changing the resource parsing interface,
> but there are obstacle to convert it to the new interface.
> Will have another try.

Please do.  I think it's extremely important to keep these arches
aligned.  And arm64, when similar code gets added to it.  Most of the
code in 

Re: [PATCH] tty/n_gsm.c: fix a memory leak when gsmtty is removed

2015-03-23 Thread Pan Xinhui

hi, Jiri
thanks for your kind reply, and the nice advices. :)

On 2015年03月23日 23:23, Jiri Slaby wrote:

On 03/24/2015, 08:22 AM, Pan Xinhui wrote:

In gsmtty_remove, we will put dlci. when dlci's ref-count is zero,
tty_port_destructor will be called, and it will check if port->itty is
NULL.
However port->itty will be set to NULL in release_tty after gsmtty_remove.
that may cause memory leak. so we use queue_work to put the dlci later.

Signed-off-by: xinhui.pan 
---
  drivers/tty/n_gsm.c | 16 ++--
  1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index c434376..50f4660 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -135,6 +135,7 @@ struct gsm_dlci {
  #define DLCI_OPEN2/* SABM/UA complete */
  #define DLCI_CLOSING3/* Sending DISC not seen UA/DM */
  struct mutex mutex;
+struct work_struct putself_work;

  /* Link layer */
  spinlock_t lock;/* Protects the internal state */
@@ -3170,14 +3171,25 @@ static int gsmtty_break_ctl(struct tty_struct
*tty, int state)
  return gsmtty_modem_update(dlci, encode);
  }

-static void gsmtty_remove(struct tty_driver *driver, struct tty_struct
*tty)
+static void put_gsm_dlci(struct work_struct *work)
  {
-struct gsm_dlci *dlci = tty->driver_data;
+struct gsm_dlci *dlci =
+container_of(work, struct gsm_dlci, putself_work);
  struct gsm_mux *gsm = dlci->gsm;

+mutex_lock(>mutex);
  dlci_put(dlci);
  dlci_put(gsm->dlci[0]);
+mutex_unlock(>mutex);
  mux_put(gsm);
+}
+
+static void gsmtty_remove(struct tty_driver *driver, struct tty_struct
*tty)
+{
+struct gsm_dlci *dlci = tty->driver_data;
+
+INIT_WORK(>putself_work, put_gsm_dlci);
+schedule_work(>putself_work)


I am afraid you cannot guarantee it is "late enough" by this approach.
The work can be already running before itty is set to NULL.



you are right, we still cannot guarantee that. Although the test shows Okay.
thanks for pointing out it.


If I am looking correctly the work can be moved from ->remove to
->cleanup, right?


thanks for your advice. I will upload pathchV2 after a full test.


And it would be worth to add a Fixes line to the commit log.
dfabf7ffa30585 introduced this.

And could you describe the scenario when it happens to the commit log
too? Like closing the other end first, before the tty.


currently dlci will be put by
1) gsmld_close --> gsm_cleanup_mux -> gsm_dlci_release -> dlci_put
and
2) gsmld_remove -> dlci_put
so there is a race. the memory leak depends on the race.

Is my comment above that you need know? sorry for my poor English.

thanks,
xinhui


thanks,


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH net v2] tcp: prevent fetching dst twice in early demux code

2015-03-23 Thread David Miller
From: Michal Kubecek 
Date: Mon, 23 Mar 2015 15:14:00 +0100 (CET)

> On s390x, gcc 4.8 compiles this part of tcp_v6_early_demux()
> 
> struct dst_entry *dst = sk->sk_rx_dst;
> 
> if (dst)
> dst = dst_check(dst, inet6_sk(sk)->rx_dst_cookie);
> 
> to code reading sk->sk_rx_dst twice, once for the test and once for
> the argument of ip6_dst_check() (dst_check() is inline). This allows
> ip6_dst_check() to be called with null first argument, causing a crash.
> 
> Protect sk->sk_rx_dst access by READ_ONCE() both in IPv4 and IPv6
> TCP early demux code.
> 
> Fixes: 41063e9dd119 ("ipv4: Early TCP socket demux.")
> Fixes: c7109986db3c ("ipv6: Early TCP socket demux")
> Signed-off-by: Michal Kubecek 

Applied and queued up for -stable.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] gfs2: incorrect check for debugfs returns

2015-03-23 Thread Chengyu Song
debugfs_create_dir and debugfs_create_file may return -ENODEV when debugfs
is not configured, so the return value should be checked against ERROR_VALUE
as well, otherwise the later dereference of the dentry pointer would crash
the kernel.

Signed-off-by: Chengyu Song 
---
 fs/gfs2/glock.c | 47 ---
 1 file changed, 28 insertions(+), 19 deletions(-)

diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index f42dffb..0fa8062 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -2047,34 +2047,41 @@ static const struct file_operations gfs2_sbstats_fops = 
{
 
 int gfs2_create_debugfs_file(struct gfs2_sbd *sdp)
 {
-   sdp->debugfs_dir = debugfs_create_dir(sdp->sd_table_name, gfs2_root);
-   if (!sdp->debugfs_dir)
-   return -ENOMEM;
-   sdp->debugfs_dentry_glocks = debugfs_create_file("glocks",
-S_IFREG | S_IRUGO,
-sdp->debugfs_dir, sdp,
-_glocks_fops);
-   if (!sdp->debugfs_dentry_glocks)
+   struct dentry *dent;
+
+   dent = debugfs_create_dir(sdp->sd_table_name, gfs2_root);
+   if (IS_ERR_OR_NULL(dent))
+   goto fail;
+   sdp->debugfs_dir = dent;
+
+   dent = debugfs_create_file("glocks",
+  S_IFREG | S_IRUGO,
+  sdp->debugfs_dir, sdp,
+  _glocks_fops);
+   if (IS_ERR_OR_NULL(dent))
goto fail;
+   sdp->debugfs_dentry_glocks = dent;
 
-   sdp->debugfs_dentry_glstats = debugfs_create_file("glstats",
-   S_IFREG | S_IRUGO,
-   sdp->debugfs_dir, sdp,
-   _glstats_fops);
-   if (!sdp->debugfs_dentry_glstats)
+   dent = debugfs_create_file("glstats",
+  S_IFREG | S_IRUGO,
+  sdp->debugfs_dir, sdp,
+  _glstats_fops);
+   if (IS_ERR_OR_NULL(dent))
goto fail;
+   sdp->debugfs_dentry_glstats = dent;
 
-   sdp->debugfs_dentry_sbstats = debugfs_create_file("sbstats",
-   S_IFREG | S_IRUGO,
-   sdp->debugfs_dir, sdp,
-   _sbstats_fops);
-   if (!sdp->debugfs_dentry_sbstats)
+   dent = debugfs_create_file("sbstats",
+  S_IFREG | S_IRUGO,
+  sdp->debugfs_dir, sdp,
+  _sbstats_fops);
+   if (IS_ERR_OR_NULL(dent))
goto fail;
+   sdp->debugfs_dentry_sbstats = dent;
 
return 0;
 fail:
gfs2_delete_debugfs_file(sdp);
-   return -ENOMEM;
+   return dent ? PTR_ERR(dent) : -ENOMEM;
 }
 
 void gfs2_delete_debugfs_file(struct gfs2_sbd *sdp)
@@ -2100,6 +2107,8 @@ void gfs2_delete_debugfs_file(struct gfs2_sbd *sdp)
 int gfs2_register_debugfs(void)
 {
gfs2_root = debugfs_create_dir("gfs2", NULL);
+   if (IS_ERR(gfs2_root))
+   return PTR_ERR(gfs2_root);
return gfs2_root ? 0 : -ENOMEM;
 }
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 2/2] f2fs: enable fast symlink by utilizing inline data

2015-03-23 Thread Wanpeng Li
Fast symlink can utilize inline data flow to avoid using any
i_addr region, since we need to handle many cases such as
truncation, roll-forward recovery, and fsck/dump tools.

Signed-off-by: Wanpeng Li 
---
 fs/f2fs/inline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c
index d3e0599..375d2c7 100644
--- a/fs/f2fs/inline.c
+++ b/fs/f2fs/inline.c
@@ -21,7 +21,7 @@ bool f2fs_may_inline(struct inode *inode)
if (f2fs_is_atomic_file(inode))
return false;
 
-   if (!S_ISREG(inode->i_mode))
+   if (!S_ISREG(inode->i_mode) && !S_ISLNK(inode->i_mode))
return false;
 
if (i_size_read(inode) > MAX_INLINE_DATA)
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 1/2] f2fs: enable inline data by default

2015-03-23 Thread Wanpeng Li
Enable inline_data feature by default since it brings us better
performance and space utilization and now has already stable.
Add another option noinline_data to disable it during mount.

Suggested-by: Jaegeuk Kim 
Suggested-by: Chao Yu 
Signed-off-by: Wanpeng Li 
---
v2 -> v3:
 * reuse F2FS_MOUNT_INLINE_DATA
 * fix show both options "inline_data,noinline_data" in ->show_options
v1 -> v2:
 * retain inline_data option and enable it by default
 * add another noinline_data option

 Documentation/filesystems/f2fs.txt | 2 ++
 fs/f2fs/super.c| 8 
 2 files changed, 10 insertions(+)

diff --git a/Documentation/filesystems/f2fs.txt 
b/Documentation/filesystems/f2fs.txt
index 48e2123..e9e750e 100644
--- a/Documentation/filesystems/f2fs.txt
+++ b/Documentation/filesystems/f2fs.txt
@@ -144,6 +144,8 @@ extent_cache   Enable an extent cache based on 
rb-tree, it can cache
as many as extent which map between contiguous logical
address and physical address per inode, resulting in
increasing the cache hit ratio.
+noinline_data  Disable the inline data feature, inline data feature is
+   enabled by default.
 
 

 DEBUGFS ENTRIES
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index fc6857f..45aa843 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -58,6 +58,7 @@ enum {
Opt_nobarrier,
Opt_fastboot,
Opt_extent_cache,
+   Opt_noinline_data,
Opt_err,
 };
 
@@ -80,6 +81,7 @@ static match_table_t f2fs_tokens = {
{Opt_nobarrier, "nobarrier"},
{Opt_fastboot, "fastboot"},
{Opt_extent_cache, "extent_cache"},
+   {Opt_noinline_data, "noinline_data"},
{Opt_err, NULL},
 };
 
@@ -372,6 +374,9 @@ static int parse_options(struct super_block *sb, char 
*options)
case Opt_extent_cache:
set_opt(sbi, EXTENT_CACHE);
break;
+   case Opt_noinline_data:
+   clear_opt(sbi, INLINE_DATA);
+   break;
default:
f2fs_msg(sb, KERN_ERR,
"Unrecognized mount option \"%s\" or missing 
value",
@@ -596,6 +601,8 @@ static int f2fs_show_options(struct seq_file *seq, struct 
dentry *root)
seq_puts(seq, ",disable_ext_identify");
if (test_opt(sbi, INLINE_DATA))
seq_puts(seq, ",inline_data");
+   else
+   seq_puts(seq, ",noinline_data");
if (test_opt(sbi, INLINE_DENTRY))
seq_puts(seq, ",inline_dentry");
if (!f2fs_readonly(sbi->sb) && test_opt(sbi, FLUSH_MERGE))
@@ -991,6 +998,7 @@ try_onemore:
sbi->active_logs = NR_CURSEG_TYPE;
 
set_opt(sbi, BG_GC);
+   set_opt(sbi, INLINE_DATA);
 
 #ifdef CONFIG_F2FS_FS_XATTR
set_opt(sbi, XATTR_USER);
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mtd: Expand the ecc placement locations to 1260

2015-03-23 Thread punnaiah choudary kalluri
On Fri, Mar 20, 2015 at 4:51 AM, Jeff Lauruhn (jlauruhn)
 wrote:
> This device has a Page size x8: 17,600 bytes (16,384 + 1216 bytes) and 
> minimum required ECC 24-bit ECC per 1100 bytes of data.  Spare area needed 
> for ECC would be ECC * M, where M is (codeword <= 2^m-1).  In this case M=14, 
> because (1100*8)<=2^14-1, therefore minimum spare area needed is 14*24 = 336b 
> or 42B per codeword.  So for this device a minimum of 672bytes of the 1216 
> need to be used for ECC, the rest can be used for other purposes.
>

Ok. Does it mean increasing the size to 672 bytes will be enough ?
I see that 672 bytes is the minimum required size for 24 bit ecc. There
may be controllers that may detect errors beyond 24 bit and would require
more number of  ecc bytes per codeword. So, i configured the ecc position
value to max oobsize and i believe this change is needed.

Regards,
Punnaiah
>
>
> Jeff Lauruhn
> NAND Application Engineer
>
>
> -Original Message-
> From: linux-mtd [mailto:linux-mtd-boun...@lists.infradead.org] On Behalf Of 
> Punnaiah Choudary Kalluri
> Sent: Thursday, March 19, 2015 1:50 AM
> To: dw...@infradead.org; computersforpe...@gmail.com
> Cc: linux-kernel@vger.kernel.org; shak...@xilinx.com; mich...@xilinx.com; 
> linux-...@lists.infradead.org; kalluripunnaiahchoud...@gmail.com; Punnaiah 
> Choudary Kalluri
> Subject: [PATCH] mtd: Expand the ecc placement locations to 1260
>
> Device like MT29F32G08ABCDBJ4 have a writesize/oobsize of 16K/1260 Bytes.
> So, increasing the maximum ecc placement locations to 1260
>
> Signed-off-by: Punnaiah Choudary Kalluri 
> ---
>  include/linux/mtd/mtd.h |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 
> f17fa75..e73d85b 100644
> --- a/include/linux/mtd/mtd.h
> +++ b/include/linux/mtd/mtd.h
> @@ -95,7 +95,7 @@ struct mtd_oob_ops {
>  };
>
>  #define MTD_MAX_OOBFREE_ENTRIES_LARGE  32
> -#define MTD_MAX_ECCPOS_ENTRIES_LARGE   640
> +#define MTD_MAX_ECCPOS_ENTRIES_LARGE   1260
>  /*
>   * Internal ECC layout control structure. For historical reasons, there is a
>   * similar, smaller struct nand_ecclayout_user (in mtd-abi.h) that is 
> retained
> --
> 1.7.4
>
>
> __
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/5] powerpc: Remove powerpc specific byteswap from bt8xx DVB driver

2015-03-23 Thread Benjamin Herrenschmidt
On Tue, 2015-02-03 at 16:36 +1100, David Gibson wrote:
> The bt8xx PCI DVB driver includes a powerpc specific hack, using one of
> the powerpc specific byteswapping functions in an IO helper macro.
> 
> There's no reason to use the powerpc specific function instead of a
> generic byteswap, so this patch removes it.  I'm not sure if the powerpc
> specific memory barrier is required, so I'm leaving that in.
> 
> Cc: Mauro Carvalho Chehab 
> Cc: Peter Hettkamp 

In fact there's no reason for the powerpc specific bits in this driver
(they might have been useful 15 years ago but they definitely aren't
anymore), I'll replace this with the patch with:

(Mauro, unless you holler ASAP, I'll just put this in my tree along
with David series due to various cross-dependencies, ie, he removes
those old crufty powerpc-specific leXX_to/from_cpu we had).


media/bt8xx: Remove old powerpc cruft

The powerpc arch code enables PCI_COMMAND_MEMORY (and has done so for
more than 10 years at least !) on pci_enable_device() and the hackery
on the MMIO accessor is useless as well, our writel does everything
this driver should need.

Signed-off-by: Benjamin Herrenschmidt 
---
 drivers/media/pci/bt8xx/bt878.c | 12 
 drivers/media/pci/bt8xx/bt878.h | 11 ---
 2 files changed, 23 deletions(-)

diff --git a/drivers/media/pci/bt8xx/bt878.c b/drivers/media/pci/bt8xx/bt878.c
index 0939d39..8aa7266 100644
--- a/drivers/media/pci/bt8xx/bt878.c
+++ b/drivers/media/pci/bt8xx/bt878.c
@@ -416,9 +416,6 @@ static int bt878_probe(struct pci_dev *dev, const struct 
pci_device_id *pci_id)
int result = 0;
unsigned char lat;
struct bt878 *bt;
-#if defined(__powerpc__)
-   unsigned int cmd;
-#endif
unsigned int cardid;
 
printk(KERN_INFO "bt878: Bt878 AUDIO function found (%d).\n",
@@ -461,15 +458,6 @@ static int bt878_probe(struct pci_dev *dev, const struct 
pci_device_id *pci_id)
printk("irq: %d, latency: %d, memory: 0x%lx\n",
   bt->irq, lat, bt->bt878_adr);
 
-
-#if defined(__powerpc__)
-   /* on OpenFirmware machines (PowerMac at least), PCI memory cycle */
-   /* response on cards with no firmware is not enabled by OF */
-   pci_read_config_dword(dev, PCI_COMMAND, );
-   cmd = (cmd | PCI_COMMAND_MEMORY);
-   pci_write_config_dword(dev, PCI_COMMAND, cmd);
-#endif
-
 #ifdef __sparc__
bt->bt878_mem = (unsigned char *) bt->bt878_adr;
 #else
diff --git a/drivers/media/pci/bt8xx/bt878.h b/drivers/media/pci/bt8xx/bt878.h
index d19b592..49af240 100644
--- a/drivers/media/pci/bt8xx/bt878.h
+++ b/drivers/media/pci/bt8xx/bt878.h
@@ -142,18 +142,7 @@ void bt878_start(struct bt878 *bt, u32 controlreg, u32 
op_sync_orin,
u32 irq_err_ignore);
 void bt878_stop(struct bt878 *bt);
 
-#if defined(__powerpc__)   /* big-endian */
-static inline void io_st_le32(volatile unsigned __iomem *addr, unsigned val)
-{
-   st_le32(addr, val);
-   eieio();
-}
-
-#define bmtwrite(dat,adr)  io_st_le32((adr),(dat))
-#define bmtread(adr)   ld_le32((adr))
-#else
 #define bmtwrite(dat,adr)  writel((dat), (adr))
 #define bmtread(adr)   readl(adr)
-#endif
 
 #endif


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [v4 2/8] iommu, x86: Define new irte structure for VT-d Posted-Interrupts

2015-03-23 Thread Wu, Feng


> -Original Message-
> From: Joerg Roedel [mailto:j...@8bytes.org]
> Sent: Monday, March 23, 2015 7:58 PM
> To: Wu, Feng
> Cc: dw...@infradead.org; jiang@linux.intel.com;
> io...@lists.linux-foundation.org; linux-kernel@vger.kernel.org
> Subject: Re: [v4 2/8] iommu, x86: Define new irte structure for VT-d
> Posted-Interrupts
> 
> Hi Feng,
> 
> On Mon, Feb 02, 2015 at 04:06:58PM +0800, Feng Wu wrote:
> > Add a new irte_pi structure for VT-d Posted-Interrupts.
> >
> > Signed-off-by: Feng Wu 
> > Reviewed-by: Jiang Liu 
> > Acked-by: David Woodhouse 
> > ---
> >  include/linux/dmar.h |   32 
> >  1 files changed, 32 insertions(+), 0 deletions(-)
> >
> > diff --git a/include/linux/dmar.h b/include/linux/dmar.h
> > index 8473756..c7f9cda 100644
> > --- a/include/linux/dmar.h
> > +++ b/include/linux/dmar.h
> > @@ -212,6 +212,38 @@ struct irte {
> > };
> >  };
> >
> > +struct irte_pi {
> 
> I think it is better to put this as a union into struct irte. It saves
> memory and unnecessary casting in later patches.

Thanks for the comments!

Do you mean doing it like the following?

struct irte {
union {
struct {
__u64   present : 1,
fpd : 1,
dst_mode: 1,
redir_hint  : 1,
trigger_mode: 1,
dlvry_mode  : 3,
avail   : 4,
__reserved_1: 4,
vector  : 8,
__reserved_2: 8,
dest_id : 32;
};
struct {
__u64   present : 1,
fpd : 1,
__reserved_1: 6,
avail   : 4,
__reserved_2: 2,
urg : 1,
pst : 1,
vector  : 8,
__reserved_3: 14,
pda_l   : 26;
};
__u64 low;
};

union {
struct {
__u64   sid : 16,
sq  : 2,
svt : 2,
__reserved_3: 44;
};
struct {
__u64   sid : 16,
sq  : 2,
svt : 2,
__reserved_4: 12,
pda_h   : 32;
};
__u64 high;
};
};

In fact, I also intended to make these two defines as one, however, this code 
will get build
error ("duplicated member") with new version of GCC, such as, gcc 4.9.1. I 
cannot find a
good way to handle this gracefully, since I don't want to impact the existing 
usage of this
structure . Do you have any ideas about this? Thanks a lot!

Thanks,
Feng

> 
> 
>   Joerg

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [pci:pci/enumeration-yw7 32/35] drivers/pci/host-bridge.c:147:24: sparse: symbol 'pci_find_host_bridge' was not declared. Should it be static?

2015-03-23 Thread Bjorn Helgaas
On Mon, Mar 23, 2015 at 8:15 PM, Yijing Wang  wrote:
>>> sparse warnings: (new ones prefixed by >>)
>>>
> drivers/pci/host-bridge.c:147:24: sparse: symbol 'pci_find_host_bridge' 
> was not declared. Should it be static?
>>>
>>> Please review and possibly fold the followup patch.
>>
>> It does look like pci_find_host_bridge() is only used inside
>> drivers/pci/host-bridge.c and could be static.  Given that it's only
>> used there, it doesn't even need to be renamed, so maybe you could
>> even just drop the rename patch, too.
>
> OK.
>
> Hi Bjorn, because this series involved lots platforms and host bridge chips, 
> and this version takes a lot of changes.
> So I didn't take lot of time to cross build this series in all the platforms 
> in my local. I hope you could see the changes
> first, and I will refresh and fix the details soon.

I just put them on a branch for build testing.  I will review them
more closely when the build problems are resolved.

FYI, I'll be on vacation from Mar 25 - Apr 2, so I won't be able to do
much then.

Bjorn
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: linux-next: manual merge of the net-next tree with the net tree

2015-03-23 Thread David Miller
From: Pablo Neira Ayuso 
Date: Mon, 23 Mar 2015 13:47:23 +0100

> On Mon, Mar 23, 2015 at 02:08:41PM +1100, Stephen Rothwell wrote:
>> Hi all,
>> 
>> Today's linux-next merge of the net-next tree got a conflict in
>> net/netfilter/nf_tables_core.c between commit 4017a7ee693d ("netfilter:
>> restore rule tracing via nfnetlink_log") from the net tree and commit
>> 01ef16c2dd2e ("netfilter: nf_tables: minor tracing cleanups") from the
>> net-next tree.
>> 
>> I fixed it up (see below) and can carry the fix as necessary (no action
>> is required).
> 
> This looks good, thanks for adressing this conflict Stephen.

Pablo, I just pushed out a merge of net into net-next, please double
check that I handled this conflict correctly.

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] ARM: socfpga: dts: Add adxl34x

2015-03-23 Thread Walter Lozano
Hi Dinh

On Mon, Mar 23, 2015 at 12:03 AM, Dinh Nguyen
 wrote:
> Hi Walter,
>
> On 3/19/15 4:27 PM, Walter Lozano wrote:
>> Hi Dinh,
>>
>> On Mon, Mar 16, 2015 at 10:10 AM, Walter Lozano
>>  wrote:
>>> On Mon, Jan 5, 2015 at 6:21 AM, Steffen Trumtrar
>>>  wrote:
 Hi!

 On Wed, Dec 24, 2014 at 08:11:52PM -0300, Walter Lozano wrote:
> This patch adds the DTS bindings for the adxl34x digital
> accelerometer.
>
> Signed-off-by: Walter Lozano 
> ---
>  arch/arm/boot/dts/socfpga_cyclone5_sockit.dts |   16 
>  1 file changed, 16 insertions(+)
>
> diff --git a/arch/arm/boot/dts/socfpga_cyclone5_sockit.dts 
> b/arch/arm/boot/dts/socfpga_cyclone5_sockit.dts
> index 16ea6f5..d343e03 100644
> --- a/arch/arm/boot/dts/socfpga_cyclone5_sockit.dts
> +++ b/arch/arm/boot/dts/socfpga_cyclone5_sockit.dts
> @@ -60,6 +60,22 @@
>   rxc-skew-ps = <2000>;
>  };
>
> + {
> + status = "okay";
> +};
> +
> + {
> + status = "okay";
> +
> + accel1: accelerometer@53 {
> + compatible = "adxl34x";
>
> Shouldn't this be "adi,adxl34x"? At least that's what the documentation
> says.
>
> + reg = <0x53>;
> +
> + interrupt-parent = <>;
> + interrupts = <3 2>;
> + };
> +};
> +
>   {
>   vmmc-supply = <_3_3v>;
>   vqmmc-supply = <_3_3v>;

 I just gave it a short spin. I get some interrupts and the position 
 property
 changes, so it seems to work:

 Acked-by: Steffen Trumtrar 

>>>
>>> Ping?
>>> How should this continue?
>>
>> Any news about this patch? It has been acked by Pavel Machek and
>> Steffen Trumtrar a while ago.
>>
>
> Sorry, since I wasn't CC on the original patch and somehow my filter
> didn't catch it, I didn't see this patch until now.

No problem, I know it was my fault as I trust the output of get_maintainer.pl

Regards,

-- 
Walter Lozano, VanguardiaSur
www.vanguardiasur.com.ar
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH] sg3_utils: Added hybrid information log utility

2015-03-23 Thread Phillip Susi
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

On 12/15/2014 07:46 PM, Phillip Susi wrote:
> On 11/25/2014 02:13 PM, Akers, Jason B wrote:
>> Hi Phillip, It turns out that this patch was based on an old 
>> github repository that doesn't appear to be updated. Doug
>> Gilbert reached out after the initial RFC and directed us to his
>> page (http://sg.danny.cz/sg/) where he has updated sg3_utils
>> code.
> 
>> As we continue to work through the feedback from our SSHD kernel
>>  patches, I'm going to follow up with Doug again on sg3_utils.
> 
> So is there a set of patches that applies to a release from that
> web site?  Also is the source only released as tarballs?  There is
> no source repo?

Hello.  I am still beta testing an SSHD drive and would very much like
to get some more information out of its logs and/or manipulate the
cache pinned working set.  Is there somewhere I can get these patched
utilities yet?

-BEGIN PGP SIGNATURE-
Version: GnuPG v1

iQEcBAEBCgAGBQJVEMt2AAoJENRVrw2cjl5RR7AH/iOPMYRoT1/gdpdVlbIfCsWw
kP9MnaWVTcqT3O1rgKbudFuMqcJGD/ScnZOIsowdnJkKxwWyGUq7w863GFtaPOul
o4DBWqLYPYFbmbsgs/meiS3I2qyFrUNGYL0Db8H2mQ2bbaXg59hJ4gO00eSvf8Zm
gMOu3njcs3REEfu/QDi2pfJXXlWMAQfgUUomxdGb1HHmnQqR7YGAdakfRXOXfNHk
Feu2QtdZTLZPkBYkcNDM22yPDSYOb6LbpbuNTYFUfPfHp8X8aejAV8zdtZx5aH7C
ZNA3DEejFqlOltT1fcgTTSb0U0WV/ZcvfTH4g9FCUfx5HOnTI5Oz86He1OthbR0=
=YMQp
-END PGP SIGNATURE-
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: exynos: allow build for !THERMAL or !CPU_THERMAL cases

2015-03-23 Thread Viresh Kumar
On 23 March 2015 at 22:13, Bartlomiej Zolnierkiewicz
 wrote:
> Would you pick this patch up or should I resend it to Rafael?

Please resend it to Rafael and cc me and linux-pm list.. Also add my
Ack to it.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Bugfix] x86/PCI/ACPI: Fix regression caused by commit 63f1789ec716

2015-03-23 Thread Jiang Liu
On 2015/3/24 0:48, Bjorn Helgaas wrote:
> On Mon, Mar 23, 2015 at 03:22:14PM +0800, Jiang Liu wrote:
>> Commit 63f1789ec716("Ignore resources consumed by host bridge itself")
>> tries to ignore resources consumed by PCI host bridge itself by
>> checking IORESOURCE_WINDOW flag, which causes regression on some
>> platforms.
> 
> "Do.  Or do not.  There is no try."
> [http://www.starwars.com/video/do-or-do-not]
> 
> That commit doesn't *try* to do something.  It *does* something.  Just
> explain what it does and what's wrong with what it does.
> 
>> For example, PC Engines APU.1C platform defines PCI MMIO resources with
>> ACPI Memory32Fixed operator as below:
>> Name (CRES, ResourceTemplate ()
>> {
>> ...
>> WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode,
>> 0x, // Granularity
>> 0x0D00, // Range Minimum
>> 0x, // Range Maximum
>> 0x, // Translation Offset
>> 0xF300, // Length
>> ,, , TypeStatic)
>> Memory32Fixed (ReadOnly,
>> 0x000A, // Address Base
>> 0x0002, // Address Length
>> )
>> Memory32Fixed (ReadOnly,
>> 0x, // Address Base
>> 0x, // Address Length
>> _Y00)
>> })
>>
>> Memory32Fixed operator doesn't support concept of "producer/consumer"
>> and it will be treated as "consumer" by the ACPI resource parsing
>> interface, thus cause regression. So the fix is only to check
>> "producer/consumer" flag for resources having "producer/consumer" flag.
> 
> Apparently the problem is with the Memory32Fixed resources above; it sounds
> like we ignore them after 63f1789ec716?  I don't quite understand how this
> fix works.  acpi_dev_filter_resource_type() has cases for both
> ACPI_RESOURCE_TYPE_FIXED_MEMORY32 and ACPI_RESOURCE_TYPE_ADDRESSxx, but 
> this patch only touches the latter, not the
> ACPI_RESOURCE_TYPE_FIXED_MEMORY32 case.
The idea is:
1) caller specifies IORESOURCE_WINDOW to query resources provided
   by the device, otherwise it's querying resources consumed by
   the device.
2) For resource descriptors having producer/consumer flag, such as
ACPI_RESOURCE_TYPE_ADDRESSxx, we check the producer/consumer flag.
3) For resource descriptors not having producer/consumer flag, such
   as ACPI_RESOURCE_TYPE_FIXED_MEMORY32, we skip checking the
   producer/consumer flag.

> 
> Is it even legal to use Memory32Fixed for a bridge window?  Is this just a
> BIOS bug?  If so, how do we know this workaround won't break something
> else for BIOSes that use Memory32Fixed correctly?
> 
> Should this be a BIOS-specific quirk?
I have searched ACPI spec 5.0 and PCI firmware spec 3.1, but haven't
found any statement tells whether Memory32Fixed could be used for
PCI host bridge resources yet. So to be honest, I'm not sure it's
legal or illegal:(

> 
> Incidentally, I also noticed this change:
> 
>   --- dmesg_3.18.0-rc5.txt2015-03-23 10:49:25.064682404 -0500
>   +++ dmesg_4.0.0-rc4.txt 2015-03-23 10:49:29.276630002 -0500
>   -ACPI: PCI Interrupt Link [INTA] (IRQs 3 4 5 7 10 11 12 15) *0, disabled.
>   +ACPI: PCI Interrupt Link [INTA] (IRQs 3 4 5 7 10 11 12 15) *0
> 
> Is it intentional that INTA was previously reported as disabled but isn't
> any more?
Thanks for reporting this, it's not intentional. Will check it.

> 
> And there's also this:
> 
>   acpi PNP0A03:00: [Firmware Bug]: no secondary bus range in _CRS
> 
> That isn't a change (it was there in 3.18, too), but that really is a
> pretty basic BIOS bug and indicates that we shouldn't be too surprised if
> it has other bugs.
> 
>> Another possible fix is to only ignore IO resource consumed by host
>> bridge and keep IOMEM resource consumed by host bridge, please refer to:
>> http://www.spinics.net/lists/linux-pci/msg39706.html
> 
> It'd be nice to have Bernhard's logs archived somewhere and referenced
> here.  This seems like a dusty corner of the code that might have to be
> revisited someday.
I have archived the acpidump at:
https://bugzilla.kernel.org/show_bug.cgi?id=94221

> 
>> Fixes: 63f1789ec716("Ignore resources consumed by host bridge itself")
>> Reported-by: Bernhard Thaler 
>> Signed-off-by: Jiang Liu 
>> ---
>> Hi Bernhard,
>>  Could you please also help to test whether this patch works for
>> you too?
>> Thanks!
>> Gerry
>> ---
>>  arch/x86/pci/acpi.c |5 ++---
>>  drivers/acpi/resource.c |3 +++
>>  2 files changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
>> index e4695985f9de..8c4b1201f340 100644
>> --- a/arch/x86/pci/acpi.c
>> +++ b/arch/x86/pci/acpi.c
>> @@ -337,7 +337,7 @@ static void probe_pci_root_info(struct pci_root_info 
>> *info,
>>  info->bridge = device;
>>  ret = acpi_dev_get_resources(device, list,
>>   acpi_dev_filter_resource_type_cb,
>> - 

[git pull] Please pull mpe/linux.git powerpc-4.0-3 tag

2015-03-23 Thread Michael Ellerman
Hi Linus,

Please pull some powerpc fixes for 4.0:

The following changes since commit 06e5801b8cb3fc057d88cb4dc03c0b64b2744cda:

  Linux 4.0-rc4 (2015-03-15 17:38:20 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/mpe/linux.git tags/powerpc-4.0-3

for you to fetch changes up to 44d5f6f5901e996744858c175baee320ccf1eda3:

  powerpc/book3s: Fix the MCE code to use CONFIG_KVM_BOOK3S_64_HANDLER 
(2015-03-23 17:10:47 +1100)


powerpc fixes for 4.0 # 2

- Fix the MCE code to use CONFIG_KVM_BOOK3S_64_HANDLER
- Little endian fixes for post mobility device tree update
- Add PVR for POWER8NVL processor
- Fixes for hypervisor doorbell handling


Benjamin Herrenschmidt (1):
  powerpc: Add PVR for POWER8NVL processor

Mahesh Salgaonkar (1):
  powerpc/book3s: Fix the MCE code to use CONFIG_KVM_BOOK3S_64_HANDLER

Paul Mackerras (1):
  powerpc/powernv: Fixes for hypervisor doorbell handling

Tyrel Datwyler (1):
  powerpc/pseries: Little endian fixes for post mobility device tree update

 arch/powerpc/include/asm/ppc-opcode.h |  3 +++
 arch/powerpc/include/asm/reg.h|  3 +++
 arch/powerpc/kernel/cputable.c| 20 ++
 arch/powerpc/kernel/dbell.c   |  2 ++
 arch/powerpc/kernel/exceptions-64s.S  |  2 +-
 arch/powerpc/platforms/powernv/smp.c  | 14 --
 arch/powerpc/platforms/pseries/mobility.c | 44 ---
 7 files changed, 64 insertions(+), 24 deletions(-)




signature.asc
Description: This is a digitally signed message part


Re: [LKP] [x86/platform, acpi] 7486341a98f: genirq: Flags mismatch irq 8. 00000080 (mmc0) vs. 00000000 (rtc0)

2015-03-23 Thread Li, Aubrey
On 2015/3/24 8:53, Huang Ying wrote:
> On Mon, 2015-03-23 at 14:18 +0800, Li, Aubrey wrote:
>> On 2015/3/20 16:38, Huang Ying wrote:
>>> FYI, we noticed the below changes on
>>>
>>> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>>> commit 7486341a98f26857f383aec88ffa10950087c3a1 ("x86/platform, acpi: 
>>> Bypass legacy PIC and PIT in ACPI hardware reduced mode")
>>>
>>>
>>> +-+++
>>> | | 394838c960 | 7486341a98 |
>>> +-+++
>>> | boot_successes  | 10 | 10 |
>>> | early-boot-hang | 1  | 1  |
>>> +-+++
>>>
>>>
>>> [   28.682462] microcode: CPU3 sig=0x30673, pf=0x2, revision=0x31e
>>> [   28.692739] microcode: Microcode Update Driver: v2.00 
>>> , Peter Oruba
>>> [   28.739947] mmc0: Reset 0x1 never completed.
>>> [   28.745155] genirq: Flags mismatch irq 8. 0080 (mmc0) vs.  
>>> (rtc0)
>>
>> mmc driver requests IRQ 8?
>> From surface it looks like either a firmware issue or ACPI get the wrong
>> IRQ resource.
>> I failed to replicate this issue with the attached config file on my
>> side, which platform is the test running?
> 
> Sorry for late.  The test was running on an ASUS T100TA.

I'm running on ASUS T100TA as well, is this replicable every time on
your side? can you please send out the acpi table on your machine?

Thanks,
-Aubrey

> 
> Best Regards,
> Huang, Ying
> 
>> Thanks,
>> -Aubrey
>>> [   28.753151] CPU: 1 PID: 138 Comm: systemd-udevd Not tainted 
>>> 4.0.0-rc4-wl-03426-gdba586f #1
>>> [   28.753156]  880076683480 8800764ffa78 818b2eb3 
>>> 0007
>>> [   28.753159]  88006d006800 8800764ffad8 810d37af 
>>> 8800764ffad8
>>> [   28.753162]  0246 810d394a 880053bdc400 
>>> 
>>> [   28.753163] Call Trace:
>>> [   28.753174]  [] dump_stack+0x4c/0x65
>>> [   28.753180]  [] __setup_irq+0x57f/0x5d0
>>> [   28.753183]  [] ? request_threaded_irq+0xaa/0x1b0
>>> [   28.753191]  [] ? sdhci_request+0x200/0x200 [sdhci]
>>> [   28.753194]  [] request_threaded_irq+0xf4/0x1b0
>>> [   28.753199]  [] sdhci_add_host+0x800/0xf90 [sdhci]
>>> [   28.753205]  [] sdhci_acpi_probe+0x348/0x440 
>>> [sdhci_acpi]
>>> [   28.753210]  [] platform_drv_probe+0x34/0xa0
>>> [   28.753215]  [] driver_probe_device+0x90/0x3e0
>>> [   28.753218]  [] __driver_attach+0x9b/0xa0
>>> [   28.753221]  [] ? __device_attach+0x40/0x40
>>> [   28.753231]  [] bus_for_each_dev+0x6b/0xb0
>>> [   28.753234]  [] driver_attach+0x1e/0x20
>>> [   28.753237]  [] bus_add_driver+0x180/0x250
>>> [   28.753240]  [] ? 0xa002e000
>>> [   28.753243]  [] driver_register+0x64/0xf0
>>> [   28.753246]  [] __platform_driver_register+0x4a/0x50
>>> [   28.753250]  [] sdhci_acpi_driver_init+0x17/0x1000 
>>> [sdhci_acpi]
>>> [   28.753254]  [] do_one_initcall+0xc0/0x1f0
>>> [   28.753259]  [] ? kmem_cache_alloc_trace+0x1cc/0x240
>>> [   28.753262]  [] ? do_init_module+0x28/0x1dd
>>> [   28.753266]  [] do_init_module+0x61/0x1dd
>>> [   28.753270]  [] load_module+0x189f/0x1be0
>>> [   28.753274]  [] ? store_uevent+0x40/0x40
>>> [   28.753279]  [] SyS_finit_module+0x86/0xb0
>>> [   28.753283]  [] system_call_fastpath+0x12/0x17
>>> [   28.753700] mmc0: Failed to request IRQ 8: -16
>>> [   28.975382] IOAPIC[0]: Set routing entry (8-16 -> 0x32 -> IRQ 13 Mode:1 
>>> Active:1 Dest:15)
>>> [   28.975934] sdhci-acpi: probe of INT33BB:00 failed with error -16
>>>
>>>
>>> Thanks,
>>> Ying Huang
>>>
>>>
>>>
>>> ___
>>> LKP mailing list
>>> l...@linux.intel.com
>>>
>>
> 
> 
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: rhashtable: warnings caused by "rhashtable: Fix use-after-free in rhashtable_walk_stop"

2015-03-23 Thread David Miller
From: Herbert Xu 
Date: Tue, 24 Mar 2015 09:53:17 +1100

> rhashtable: Fix sleeping inside RCU critical section in walk_stop
> 
> The commit 963ecbd41a1026d99ec7537c050867428c397b89 ("rhashtable:
> Fix use-after-free in rhashtable_walk_stop") fixed a real bug
> but created another one because we may end up sleeping inside an
> RCU critical section.
> 
> This patch fixes it properly by replacing the mutex with a spin
> lock that specifically protects the walker lists.
> 
> Reported-by: Sasha Levin 
> Signed-off-by: Herbert Xu 

Applied, thanks everyone.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[git pull] drm urgent fix

2015-03-23 Thread Dave Airlie

Hi Linus,

a few people reported an oops that looks to be fixed in drm-next already, 
so I've pulled the patch back.

Dave.

The following changes since commit 90a5a895cc8b284ac522757a01de15e36710c2b9:

  Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net (2015-03-23 
10:16:13 -0700)

are available in the git repository at:

  git://people.freedesktop.org/~airlied/linux drm-fixes

for you to fetch changes up to 8218c3f4df3bb1c637c17552405039a6dd3c1ee1:

  drm: Fixup racy refcounting in plane_force_disable (2015-03-24 12:04:35 +1000)


Daniel Vetter (1):
  drm: Fixup racy refcounting in plane_force_disable

 drivers/gpu/drm/drm_crtc.c | 13 +
 1 file changed, 1 insertion(+), 12 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


linux-next: manual merge of the thermal-soc tree with the thermal tree

2015-03-23 Thread Stephen Rothwell
Hi Eduardo,

Today's linux-next merge of the thermal-soc tree got a conflict in
include/linux/thermal.h between commit 33f1e05e1536 ("Thermal:
initialize thermal zone device correctly") from the thermal tree and
commit f7e41876c4b2 ("thermal: of: fix cooling device weights in device
tree") from the thermal-soc tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc include/linux/thermal.h
index 8650b0b14da4,6bbe11c97cea..
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@@ -40,9 -40,9 +40,12 @@@
  /* No upper/lower limit requirement */
  #define THERMAL_NO_LIMIT  ((u32)~0)
  
 +/* Invalid/uninitialized temperature */
 +#define THERMAL_TEMP_INVALID  -27400
 +
+ /* Default weight of a bound cooling device */
+ #define THERMAL_WEIGHT_DEFAULT 0
+ 
  /* Unit conversion macros */
  #define KELVIN_TO_CELSIUS(t)  (long)(((long)t-2732 >= 0) ?\
((long)t-2732+5)/10 : ((long)t-2732-5)/10)


pgpySq_svQ5AM.pgp
Description: OpenPGP digital signature


[PATCH] adfs: returning correct return values

2015-03-23 Thread Sanidhya Kashyap
This patch tries to fix the wrong values returned by various functions
such as EIO and ENOMEM.

Signed-off-by: Sanidhya Kashyap 
---
 fs/adfs/dir_fplus.c |  1 +
 fs/adfs/super.c | 20 +++-
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/fs/adfs/dir_fplus.c b/fs/adfs/dir_fplus.c
index f2ba88a..82d14cd 100644
--- a/fs/adfs/dir_fplus.c
+++ b/fs/adfs/dir_fplus.c
@@ -61,6 +61,7 @@ adfs_fplus_read(struct super_block *sb, unsigned int id, 
unsigned int sz, struct
kcalloc(size, sizeof(struct buffer_head *),
GFP_KERNEL);
if (!bh_fplus) {
+   ret = -ENOMEM;
adfs_error(sb, "not enough memory for"
" dir object %X (%d blocks)", id, size);
goto out;
diff --git a/fs/adfs/super.c b/fs/adfs/super.c
index 9852bdf..a19c31d 100644
--- a/fs/adfs/super.c
+++ b/fs/adfs/super.c
@@ -316,7 +316,7 @@ static struct adfs_discmap *adfs_read_map(struct 
super_block *sb, struct adfs_di
dm = kmalloc(nzones * sizeof(*dm), GFP_KERNEL);
if (dm == NULL) {
adfs_error(sb, "not enough memory");
-   return NULL;
+   return ERR_PTR(-ENOMEM);
}
 
for (zone = 0; zone < nzones; zone++, map_addr++) {
@@ -349,7 +349,7 @@ error_free:
brelse(dm[zone].dm_bh);
 
kfree(dm);
-   return NULL;
+   return ERR_PTR(-EIO);
 }
 
 static inline unsigned long adfs_discsize(struct adfs_discrecord *dr, int 
block_bits)
@@ -370,6 +370,7 @@ static int adfs_fill_super(struct super_block *sb, void 
*data, int silent)
unsigned char *b_data;
struct adfs_sb_info *asb;
struct inode *root;
+   int ret = -EINVAL;
 
sb->s_flags |= MS_NODIRATIME;
 
@@ -391,6 +392,7 @@ static int adfs_fill_super(struct super_block *sb, void 
*data, int silent)
sb_set_blocksize(sb, BLOCK_SIZE);
if (!(bh = sb_bread(sb, ADFS_DISCRECORD / BLOCK_SIZE))) {
adfs_error(sb, "unable to read superblock");
+   ret = -EIO;
goto error;
}
 
@@ -400,6 +402,7 @@ static int adfs_fill_super(struct super_block *sb, void 
*data, int silent)
if (!silent)
printk("VFS: Can't find an adfs filesystem on dev "
"%s.\n", sb->s_id);
+   ret = -EINVAL;
goto error_free_bh;
}
 
@@ -412,6 +415,7 @@ static int adfs_fill_super(struct super_block *sb, void 
*data, int silent)
if (!silent)
printk("VPS: Can't find an adfs filesystem on dev "
"%s.\n", sb->s_id);
+   ret = -EINVAL;
goto error_free_bh;
}
 
@@ -421,11 +425,13 @@ static int adfs_fill_super(struct super_block *sb, void 
*data, int silent)
if (!bh) {
adfs_error(sb, "couldn't read superblock on "
"2nd try.");
+   ret = -EIO;
goto error;
}
b_data = bh->b_data + (ADFS_DISCRECORD % sb->s_blocksize);
if (adfs_checkbblk(b_data)) {
adfs_error(sb, "disc record mismatch, very weird!");
+   ret = -EINVAL;
goto error_free_bh;
}
dr = (struct adfs_discrecord *)(b_data + ADFS_DR_OFFSET);
@@ -433,6 +439,7 @@ static int adfs_fill_super(struct super_block *sb, void 
*data, int silent)
if (!silent)
printk(KERN_ERR "VFS: Unsupported blocksize on dev "
"%s.\n", sb->s_id);
+   ret = -EINVAL;
goto error;
}
 
@@ -447,10 +454,12 @@ static int adfs_fill_super(struct super_block *sb, void 
*data, int silent)
asb->s_size = adfs_discsize(dr, sb->s_blocksize_bits);
asb->s_version  = dr->format_version;
asb->s_log2sharesize= dr->log2sharesize;
-   
+
asb->s_map = adfs_read_map(sb, dr);
-   if (!asb->s_map)
+   if (IS_ERR(asb->s_map)) {
+   ret =  PTR_ERR(asb->s_map);
goto error_free_bh;
+   }
 
brelse(bh);
 
@@ -499,6 +508,7 @@ static int adfs_fill_super(struct super_block *sb, void 
*data, int silent)
brelse(asb->s_map[i].dm_bh);
kfree(asb->s_map);
adfs_error(sb, "get root inode failed\n");
+   ret = -EIO;
goto error;
}
return 0;
@@ -508,7 +518,7 @@ error_free_bh:
 error:
sb->s_fs_info = NULL;
kfree(asb);
-   return -EINVAL;
+   return ret;
 }
 
 static struct dentry *adfs_mount(struct file_system_type *fs_type,
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe 

Re: [PATCH v2] perf tools: Remove (null) value of "Sort order" for perf mem report

2015-03-23 Thread Yunlong Song
On 2015/3/24 0:15, Arnaldo Carvalho de Melo wrote:
> Em Mon, Mar 23, 2015 at 11:50:05AM +0800, Yunlong Song escreveu:
>> Signed-off-by: Yunlong Song 
>> Signed-off-by: Namhyung Kim 
> 
> Humm, this doesn't seem to apply (Namhyung's S-o-B), as this patch was
> made by you and is not going thru him, right? And I haven't seen him
> providing any endorsement tags.
> 
> Can you clarify?
> 
> I tested the change and it works for me, btw.
> 
> - Arnaldo
> 
> .
> 
Got it, Namhyung has added his acked-by, thanks.

-- 
Thanks,
Yunlong Song

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] lguest: explicitly set miscdevice's private_data NULL

2015-03-23 Thread Rusty Russell
Martin Kepplinger  writes:
> There is a proposed change to the miscdevice's behaviour on open(). Currently
> file->private_data stays NULL, but only because we don't have an open-entry in
> struct file_operations.
>
> This may change so that private_data, more consistently, is always set to
> struct miscdevice, not only *if* the driver has it's own open() routine and
> fops-entry, see https://lkml.org/lkml/2014/12/4/939 and commit
> 94e4fe2cab3d43b3ba7c3f721743006a8c9d913a
>
> In short: If we rely on file->private_data being NULL, we should ensure
> it is NULL ourselves.
>
> Signed-off-by: Martin Kepplinger 

OK, applied.

Thanks,
Rusty.

> ---
>  drivers/lguest/lguest_user.c | 8 
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c
> index c4c6113..30c6068 100644
> --- a/drivers/lguest/lguest_user.c
> +++ b/drivers/lguest/lguest_user.c
> @@ -339,6 +339,13 @@ static ssize_t write(struct file *file, const char 
> __user *in,
>   }
>  }
>  
> +static int open(struct inode *inode, struct file *file)
> +{
> + file->private_data = NULL;
> +
> + return 0;
> +}
> +
>  /*L:060
>   * The final piece of interface code is the close() routine.  It reverses
>   * everything done in initialize().  This is usually called because the
> @@ -409,6 +416,7 @@ static int close(struct inode *inode, struct file *file)
>   */
>  static const struct file_operations lguest_fops = {
>   .owner   = THIS_MODULE,
> + .open= open,
>   .release = close,
>   .write   = write,
>   .read= read,
> -- 
> 2.1.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V2 2/2] af_packet: pass checksum validation status to the user

2015-03-23 Thread David Miller
From: Alexander Drozdov 
Date: Mon, 23 Mar 2015 09:11:13 +0300

> Introduce TP_STATUS_CSUM_VALID tp_status flag to tell the
> af_packet user that at least the transport header checksum
> has been already validated.
> 
> For now, the flag may be set for incoming packets only.
> 
> Signed-off-by: Alexander Drozdov 

Applied to net-next
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V2 1/2] af_packet: make tpacket_rcv to not set status value before run_filter

2015-03-23 Thread David Miller
From: Alexander Drozdov 
Date: Mon, 23 Mar 2015 09:11:12 +0300

> It is just an optimization. We don't need the value of status variable
> if the packet is filtered.
> 
> Signed-off-by: Alexander Drozdov 

Applied to net-next
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] dlm: incorrect check for debugfs returns

2015-03-23 Thread Chengyu Song
debugfs_create_dir and debugfs_create_file may return -ENODEV when debugfs
is not configured, so the return value should be checked against ERROR_VALUE
as well, otherwise the later dereference of the dentry pointer would crash
the kernel.

Signed-off-by: Chengyu Song 
---
 fs/dlm/debug_fs.c | 70 +++
 1 file changed, 39 insertions(+), 31 deletions(-)

diff --git a/fs/dlm/debug_fs.c b/fs/dlm/debug_fs.c
index eea6491..65666c8 100644
--- a/fs/dlm/debug_fs.c
+++ b/fs/dlm/debug_fs.c
@@ -709,78 +709,86 @@ void dlm_delete_debug_file(struct dlm_ls *ls)
 int dlm_create_debug_file(struct dlm_ls *ls)
 {
char name[DLM_LOCKSPACE_LEN+8];
+   struct dentry *dent;
 
/* format 1 */
 
-   ls->ls_debug_rsb_dentry = debugfs_create_file(ls->ls_name,
- S_IFREG | S_IRUGO,
- dlm_root,
- ls,
- _fops);
-   if (!ls->ls_debug_rsb_dentry)
+   dent = debugfs_create_file(ls->ls_name,
+  S_IFREG | S_IRUGO,
+  dlm_root,
+  ls,
+  _fops);
+   if (IS_ERR_OR_NULL(dent))
goto fail;
+   ls->ls_debug_rsb_dentry = dent;
 
/* format 2 */
 
memset(name, 0, sizeof(name));
snprintf(name, DLM_LOCKSPACE_LEN+8, "%s_locks", ls->ls_name);
 
-   ls->ls_debug_locks_dentry = debugfs_create_file(name,
-   S_IFREG | S_IRUGO,
-   dlm_root,
-   ls,
-   _fops);
-   if (!ls->ls_debug_locks_dentry)
+   dent = debugfs_create_file(name,
+  S_IFREG | S_IRUGO,
+  dlm_root,
+  ls,
+  _fops);
+   if (IS_ERR_OR_NULL(dent))
goto fail;
+   ls->ls_debug_locks_dentry = dent;
 
/* format 3 */
 
memset(name, 0, sizeof(name));
snprintf(name, DLM_LOCKSPACE_LEN+8, "%s_all", ls->ls_name);
 
-   ls->ls_debug_all_dentry = debugfs_create_file(name,
- S_IFREG | S_IRUGO,
- dlm_root,
- ls,
- _fops);
-   if (!ls->ls_debug_all_dentry)
+   dent = debugfs_create_file(name,
+  S_IFREG | S_IRUGO,
+  dlm_root,
+  ls,
+  _fops);
+   if (IS_ERR_OR_NULL(dent))
goto fail;
+   ls->ls_debug_all_dentry = dent;
 
/* format 4 */
 
memset(name, 0, sizeof(name));
snprintf(name, DLM_LOCKSPACE_LEN+8, "%s_toss", ls->ls_name);
 
-   ls->ls_debug_toss_dentry = debugfs_create_file(name,
-  S_IFREG | S_IRUGO,
-  dlm_root,
-  ls,
-  _fops);
-   if (!ls->ls_debug_toss_dentry)
+   dent = debugfs_create_file(name,
+  S_IFREG | S_IRUGO,
+  dlm_root,
+  ls,
+  _fops);
+   if (IS_ERR_OR_NULL(dent))
goto fail;
+   ls->ls_debug_toss_dentry = dent;
 
memset(name, 0, sizeof(name));
snprintf(name, DLM_LOCKSPACE_LEN+8, "%s_waiters", ls->ls_name);
 
-   ls->ls_debug_waiters_dentry = debugfs_create_file(name,
- S_IFREG | S_IRUGO,
- dlm_root,
- ls,
- _fops);
-   if (!ls->ls_debug_waiters_dentry)
+   dent = debugfs_create_file(name,
+  S_IFREG | S_IRUGO,
+  dlm_root,
+  ls,
+  _fops);
+   if (IS_ERR_OR_NULL(dent))
goto fail;
+   ls->ls_debug_waiters_dentry = dent;
 
return 0;
 
  fail:
dlm_delete_debug_file(ls);
-   return -ENOMEM;
+   return dent ? PTR_ERR(dent) : -ENOMEM;
 }
 
 int __init dlm_register_debugfs(void)
 {
mutex_init(_buf_lock);
dlm_root = debugfs_create_dir("dlm", NULL);
+  

[PATCH] cx82310_eth: fix semicolon.cocci warnings

2015-03-23 Thread kbuild test robot
drivers/net/usb/cx82310_eth.c:175:2-3: Unneeded semicolon


 Removes unneeded semicolon.

Generated by: scripts/coccinelle/misc/semicolon.cocci

CC: Ondrej Zary 
Signed-off-by: Fengguang Wu 
---

 cx82310_eth.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/usb/cx82310_eth.c
+++ b/drivers/net/usb/cx82310_eth.c
@@ -172,7 +172,7 @@ static int cx82310_bind(struct usbnet *d
if (!ret && link[0] == 1 && link[2] == 1)
break;
msleep(500);
-   };
+   }
if (!timeout) {
dev_err(>dev, "firmware not ready in time\n");
return -ETIMEDOUT;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH RESEND 2/7] scsi: storvsc: Size the queue depth based on the ringbuffer size

2015-03-23 Thread KY Srinivasan


> -Original Message-
> From: Venkatesh Srinivas [mailto:venkate...@google.com]
> Sent: Monday, March 23, 2015 5:23 PM
> To: KY Srinivasan
> Cc: gre...@linuxfoundation.org; Linux Kernel Developers List;
> de...@linuxdriverproject.org; oher...@suse.com; James E.J. Bottomley;
> Christoph Hellwig; linux-s...@vger.kernel.org; a...@canonical.com;
> vkuzn...@redhat.com; jasow...@redhat.com
> Subject: Re: [PATCH RESEND 2/7] scsi: storvsc: Size the queue depth based
> on the ringbuffer size
> 
> On Mon, Mar 23, 2015 at 2:06 PM, K. Y. Srinivasan 
> wrote:
> > Size the queue depth based on the ringbuffer size. Also accomodate for
> the
> > fact that we could have multiple channels (ringbuffers) per adaptor.
> >
> > Signed-off-by: K. Y. Srinivasan 
> > Reviewed-by: Long Li 
> > ---
> >  drivers/scsi/storvsc_drv.c |   27 ---
> >  1 files changed, 16 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
> > index 27fe850..5a12897 100644
> > --- a/drivers/scsi/storvsc_drv.c
> > +++ b/drivers/scsi/storvsc_drv.c
> > @@ -309,10 +309,15 @@ enum storvsc_request_type {
> >   */
> >
> >  static int storvsc_ringbuffer_size = (256 * PAGE_SIZE);
> > +static u32 max_outstanding_req_per_channel;
> > +
> > +static int storvsc_vcpus_per_sub_channel = 4;
> >
> >  module_param(storvsc_ringbuffer_size, int, S_IRUGO);
> >  MODULE_PARM_DESC(storvsc_ringbuffer_size, "Ring buffer size
> (bytes)");
> >
> > +module_param(storvsc_vcpus_per_sub_channel, int, S_IRUGO);
> > +MODULE_PARM_DESC(vcpus_per_sub_channel, "Ratio of VCPUs to
> subchannels");
> >  /*
> >   * Timeout in seconds for all devices managed by this driver.
> >   */
> > @@ -320,7 +325,6 @@ static int storvsc_timeout = 180;
> >
> >  static int msft_blist_flags = BLIST_TRY_VPD_PAGES;
> >
> > -#define STORVSC_MAX_IO_REQUESTS200
> >
> >  static void storvsc_on_channel_callback(void *context);
> >
> > @@ -1376,7 +1380,6 @@ static int storvsc_do_io(struct hv_device *device,
> >
> >  static int storvsc_device_configure(struct scsi_device *sdevice)
> >  {
> > -   scsi_change_queue_depth(sdevice, STORVSC_MAX_IO_REQUESTS);
> >
> > blk_queue_max_segment_size(sdevice->request_queue,
> PAGE_SIZE);
> >
> > @@ -1646,7 +1649,6 @@ static struct scsi_host_template scsi_driver = {
> > .eh_timed_out = storvsc_eh_timed_out,
> > .slave_configure =  storvsc_device_configure,
> > .cmd_per_lun =  255,
> > -   .can_queue =
> STORVSC_MAX_IO_REQUESTS*STORVSC_MAX_TARGETS,
> > .this_id =  -1,
> > /* no use setting to 0 since ll_blk_rw reset it to 1 */
> > /* currently 32 */
> > @@ -1686,6 +1688,7 @@ static int storvsc_probe(struct hv_device *device,
> > const struct hv_vmbus_device_id *dev_id)
> >  {
> > int ret;
> > +   int num_cpus = num_online_cpus();
> > struct Scsi_Host *host;
> > struct hv_host_device *host_dev;
> > bool dev_is_ide = ((dev_id->driver_data == IDE_GUID) ? true : 
> > false);
> > @@ -1694,6 +1697,7 @@ static int storvsc_probe(struct hv_device *device,
> > int max_luns_per_target;
> > int max_targets;
> > int max_channels;
> > +   int max_sub_channels = 0;
> >
> > /*
> >  * Based on the windows host we are running on,
> > @@ -1719,12 +1723,18 @@ static int storvsc_probe(struct hv_device
> *device,
> > max_luns_per_target = STORVSC_MAX_LUNS_PER_TARGET;
> > max_targets = STORVSC_MAX_TARGETS;
> > max_channels = STORVSC_MAX_CHANNELS;
> > +   /*
> > +* On Windows8 and above, we support sub-channels for 
> > storage.
> > +* The number of sub-channels offerred is based on the 
> > number
> of
> > +* VCPUs in the guest.
> > +*/
> > +   max_sub_channels = (num_cpus /
> storvsc_vcpus_per_sub_channel);
> > break;
> > }
> >
> > -   if (dev_id->driver_data == SFC_GUID)
> > -   scsi_driver.can_queue = (STORVSC_MAX_IO_REQUESTS *
> > -STORVSC_FC_MAX_TARGETS);
> > +   scsi_driver.can_queue = (max_outstanding_req_per_channel *
> > +max_sub_channels + 1);
> > +
> 
> If num_online_cpus() returned 1 - 3, can_queue will be set to 1 I
> think. Is that desired?

can_ queue will be set  max_outstanding_req_per_channel in
this case. That is what is expected. We will always have the primary channel;
Additionally, if the guest has more than 4 VCPUs, the host will offer
Additional subchannels for each 4 VCPus in the guest. So for less than
4 VCPus in the guest, we will only have the primary channel.


Regards,

K. Y
N�r��yb�X��ǧv�^�)޺{.n�+{zX����ܨ}���Ơz�:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf��^jǫy�m��@A�a���
0��h���i

[PATCH] iommu/vt-d: Remove unused variable

2015-03-23 Thread Alex Williamson
Unused after commit 71684406905f ("iommu/vt-d: Detach domain *only*
from attached iommus").  Reported by 0-day builder.

Signed-off-by: Alex Williamson 
---
 drivers/iommu/intel-iommu.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 6228582..0e5ca10 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -1743,7 +1743,6 @@ static int domain_init(struct dmar_domain *domain, int 
guest_width)
 
 static void domain_exit(struct dmar_domain *domain)
 {
-   struct dmar_drhd_unit *drhd;
struct page *freelist = NULL;
int i;
 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [git pull] drm fixes

2015-03-23 Thread Dave Jones
On Mon, Mar 23, 2015 at 11:33:42AM -0400, Josh Boyer wrote:
 
 > I have a machine that no longer boots in a headless manner with -rc5.
 > It's an Celeron based NUC device.  I blacklisted the i915 driver and
 > it boots fine, then I ran insmod manually and got the backtrace below.
 > This machine only has HDMI output on it.  If I have it connected (even
 > if the monitor is set to display some other input) it will boot fine,
 > but the backtrace is still present.  I'm going to guess the machine
 > "hangs" in headless because X causes some further issues in the
 > headless case.
 > 
 > Linux v4.0-rc4-199-gb314acaccd7e gets this splat in the headless state:
 > 
 > [  +0.39] WARNING: CPU: 0 PID: 63 at
 > drivers/gpu/drm/i915/i915_gem.c:4525 i915_gem_free_object+0x2e5/0x320
 > [i915]()
 > [  +0.02] WARN_ON(obj->frontbuffer_bits)
 > 
 > which is what I thought one of these commits was supposed to fix.  I
 > don't see that in -rc5, but then we have these other issues.
 

 > [  +0.37] WARNING: CPU: 1 PID: 1486 at include/linux/kref.h:47
 > drm_framebuffer_reference+0x7a/0x90 [drm]()
 ..
 > [  +0.37] WARNING: CPU: 0 PID: 563 at
 > drivers/gpu/drm/drm_atomic.c:482 drm_atomic_check_only+0x33d/0x500
 > [drm]()

I've started seeing this one too as of rc5.
Along with..

 
=
BUG kmalloc-192 (Tainted: GW  ): Poison overwritten
-
Disabling lock debugging due to kernel taint
INFO: 0x8804277e5c78-0x8804277e5c78. First byte 0x6a instead of 0x6b
INFO: Allocated in ironlake_get_initial_plane_config+0x86/0x390 [i915] age=175 
cpu=5 pid=313
__slab_alloc.constprop.79+0x5a9/0x670
kmem_cache_alloc_trace+0x21f/0x300
ironlake_get_initial_plane_config+0x86/0x390 [i915]
intel_modeset_init+0x9d9/0x1a50 [i915]
i915_driver_load+0xebf/0x1150 [i915]
drm_dev_register+0xb5/0x110 [drm]
drm_get_pci_dev+0x8d/0x200 [drm]
i915_pci_probe+0x3b/0x60 [i915]
pci_device_probe+0x8c/0xf0
driver_probe_device+0x90/0x3e0
__driver_attach+0xa3/0xb0
bus_for_each_dev+0x73/0xc0
driver_attach+0x1e/0x20
bus_add_driver+0x188/0x260
driver_register+0x64/0xf0
__pci_register_driver+0x64/0x70
INFO: Freed in intel_user_framebuffer_destroy+0x65/0xa0 [i915] age=40 cpu=0 
pid=128
__slab_free+0x19e/0x2c0
kfree+0x2c1/0x310
intel_user_framebuffer_destroy+0x65/0xa0 [i915]
drm_framebuffer_free+0x50/0x60 [drm]
drm_framebuffer_unreference+0x35/0x70 [drm]
drm_atomic_helper_plane_destroy_state+0x1f/0x30 [drm_kms_helper]
intel_plane_destroy_state+0xe/0x10 [i915]
drm_plane_helper_commit+0xb2/0x2e0 [drm_kms_helper]
drm_plane_helper_update+0x9a/0xf0 [drm_kms_helper]
__intel_set_mode+0x8b5/0xb70 [i915]
intel_crtc_set_config+0xc4b/0x1030 [i915]
drm_mode_set_config_internal+0x69/0x120 [drm]
restore_fbdev_mode+0xc8/0xf0 [drm_kms_helper]
drm_fb_helper_restore_fbdev_mode_unlocked+0x29/0x80 [drm_kms_helper]
drm_fb_helper_set_par+0x22/0x50 [drm_kms_helper]
intel_fbdev_set_par+0x1a/0x60 [i915]
INFO: Slab 0xea00109df900 objects=31 used=31 fp=0x  (null) 
flags=0x80004080
INFO: Object 0x8804277e5c70 @offset=7280 fp=0x8804277e6288
Bytes b4 8804277e5c60: 54 7a fb ff 00 00 00 00 5a 5a 5a 5a 5a 5a 5a 5a  
Tz..
Object 8804277e5c70: 6b 6b 6b 6b 6b 6b 6b 6b 6a 6b 6b 6b 6b 6b 6b 6b  
jkkk
Object 8804277e5c80: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  

Object 8804277e5c90: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  

Object 8804277e5ca0: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  

Object 8804277e5cb0: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  

Object 8804277e5cc0: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  

Object 8804277e5cd0: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  

Object 8804277e5ce0: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  

Object 8804277e5cf0: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  

Object 8804277e5d00: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  

Object 8804277e5d10: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  

Object 8804277e5d20: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b a5  
kkk.
Redzone 8804277e5d30: bb bb bb bb bb bb bb bb  

Padding 8804277e5e70: 5a 5a 5a 5a 5a 5a 5a 5a  

CPU: 4 PID: 128 Comm: kworker/u16:4 Tainted: GB   W   
4.0.0-rc5-backupdebug+ #1
Workqueue: events_unbound async_run_entry_fn
 8804277e5c70 2ebc2945 

[PATCH] USB: ftdi_sio: Use jtag quirk for SNAP Connect E10

2015-03-23 Thread Doug Goldstein
This patch uses the existing CALAO Systems ftdi_8u2232c_probe in order
to avoid attaching a TTY to the JTAG port as this board is based on the
CALAO Systems reference design and needs the same fix up.

Signed-off-by: Doug Goldstein 
CC: stable 
---
 drivers/usb/serial/ftdi_sio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 3086dec..27076d7 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1884,7 +1884,8 @@ static int ftdi_8u2232c_probe(struct usb_serial *serial)
struct usb_device *udev = serial->dev;
 
if ((udev->manufacturer && !strcmp(udev->manufacturer, "CALAO 
Systems")) ||
-   (udev->product && !strcmp(udev->product, "BeagleBone/XDS100V2")))
+   (udev->product && !strcmp(udev->product, "BeagleBone/XDS100V2")) ||
+   (udev->product && !strcmp(udev->product, "SNAP Connect E10")))
return ftdi_jtag_probe(serial);
 
return 0;
-- 
2.0.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCHv2] mm/compaction: reset compaction scanner positions

2015-03-23 Thread Gioh Kim
When the compaction is activated via /proc/sys/vm/compact_memory
it would better scan the whole zone.
And some platform, for instance ARM, has the start_pfn of a zone is zero.
Therefore the first try to compaction via /proc doesn't work.
It needs to force to reset compaction scanner position at first.

Signed-off-by: Gioh Kim 
Acked-by: Vlastimil Babka 
Acked-by: David Rientjes 
---
 mm/compaction.c |8 
 1 file changed, 8 insertions(+)

diff --git a/mm/compaction.c b/mm/compaction.c
index 8c0d945..ccf48ce 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1587,6 +1587,14 @@ static void __compact_pgdat(pg_data_t *pgdat, struct 
compact_control *cc)
INIT_LIST_HEAD(>freepages);
INIT_LIST_HEAD(>migratepages);
 
+   /*
+* When called via /proc/sys/vm/compact_memory
+* this makes sure we compact the whole zone regardless of
+* cached scanner positions.
+*/
+   if (cc->order == -1)
+   __reset_isolation_suitable(zone);
+
if (cc->order == -1 || !compaction_deferred(zone, cc->order))
compact_zone(zone, cc);
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mm/compaction: reset compaction scanner positions

2015-03-23 Thread Gioh Kim



2015-03-24 오전 8:16에 David Rientjes 이(가) 쓴 글:

On Sat, 21 Mar 2015, Gioh Kim wrote:


When the compaction is activated via /proc/sys/vm/compact_memory
it would better scan the whole zone.
And some platform, for instance ARM, has the start_pfn of a zone is zero.
Therefore the first try to compaction via /proc doesn't work.
It needs to force to reset compaction scanner position at first.

Signed-off-by: Gioh Kim 


That shouldn't be a valid email address.


It's my fault. I'm going to send patch again.




Acked-by: Vlastimil Babka 


Acked-by: David Rientjes 

I was thinking that maybe this would be better handled as part of the
comapct_zone() logic, i.e. set cc->free_pfn and cc->migrate_pfn based on a
helper function that understands cc->order == -1 should compact the entire
zone.  However, after scanning the entire zone as a result of this write,
the existing cached pfns probably don't matter anymore.  So this seems
fine.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [pci:pci/enumeration-yw7 32/35] drivers/pci/host-bridge.c:147:24: sparse: symbol 'pci_find_host_bridge' was not declared. Should it be static?

2015-03-23 Thread Yijing Wang
>> sparse warnings: (new ones prefixed by >>)
>>
 drivers/pci/host-bridge.c:147:24: sparse: symbol 'pci_find_host_bridge' 
 was not declared. Should it be static?
>>
>> Please review and possibly fold the followup patch.
> 
> It does look like pci_find_host_bridge() is only used inside
> drivers/pci/host-bridge.c and could be static.  Given that it's only
> used there, it doesn't even need to be renamed, so maybe you could
> even just drop the rename patch, too.

OK.

Hi Bjorn, because this series involved lots platforms and host bridge chips, 
and this version takes a lot of changes.
So I didn't take lot of time to cross build this series in all the platforms in 
my local. I hope you could see the changes
first, and I will refresh and fix the details soon.

Thanks!
Yijing.

> 
> Bjorn
> 
> 


-- 
Thanks!
Yijing

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Documentation:Update Documentation/zh_CN/arm64/memory.txt

2015-03-23 Thread harryxiyou
2015-03-24 0:43 GMT+08:00  :
> From: Fu Wei 
>
> This is a update of Chinese documentation:Documentation/zh_CN/arm64/memory.txt
>
> It is based on the modifications of Documentation/arm64/memory.txt in 
> submission:
> "08375198", "4edae01e", "a24637d5", "383c2799".
>
> Signed-off-by: Fu Wei 

Signed-off-by: Weiwei Jia 


Thanks, Weiwei.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: 4.0.0-rc4: panic in free_block

2015-03-23 Thread David Ahern

On 3/23/15 1:35 PM, David Miller wrote:

From: David Ahern 
Date: Mon, 23 Mar 2015 11:34:34 -0600


seems like a formality at this point, but this resolves the panic on
the M7-based ldom and baremetal. The T5-8 failed to boot, but it could
be a different problem.


Specifically, does the T5-8 boot without my patch applied?



The T5-8 is having problems; has to be unrelated to this commit. T5-2 
(256 cpus) boots fine, and make -j 256 on an allyesconfig builds fine.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] selinuxfs: Fix sel_write_enforce broken return value

2015-03-23 Thread Joe Perches
Return a negative error value like the rest
of the entries in this function.

Signed-off-by: Joe Perches 
---
Maybe this should be stable, it goes back to
commit b77a493b1dc8 ("SELinux: standardize return code
handling in selinuxfs.c") back in Nov 2010, but it's
guarded by a #ifdef CONFIG_SECURITY_SELINUX_DEVELOP
so it probably doesn't matter much.

 security/selinux/selinuxfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index 1684bcc..5fde343 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -152,7 +152,7 @@ static ssize_t sel_write_enforce(struct file *file, const 
char __user *buf,
goto out;
 
/* No partial writes. */
-   length = EINVAL;
+   length = -EINVAL;
if (*ppos != 0)
goto out;
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [LKP] [x86/platform, acpi] 7486341a98f: genirq: Flags mismatch irq 8. 00000080 (mmc0) vs. 00000000 (rtc0)

2015-03-23 Thread Huang Ying
On Mon, 2015-03-23 at 14:18 +0800, Li, Aubrey wrote:
> On 2015/3/20 16:38, Huang Ying wrote:
> > FYI, we noticed the below changes on
> > 
> > git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > commit 7486341a98f26857f383aec88ffa10950087c3a1 ("x86/platform, acpi: 
> > Bypass legacy PIC and PIT in ACPI hardware reduced mode")
> > 
> > 
> > +-+++
> > | | 394838c960 | 7486341a98 |
> > +-+++
> > | boot_successes  | 10 | 10 |
> > | early-boot-hang | 1  | 1  |
> > +-+++
> > 
> > 
> > [   28.682462] microcode: CPU3 sig=0x30673, pf=0x2, revision=0x31e
> > [   28.692739] microcode: Microcode Update Driver: v2.00 
> > , Peter Oruba
> > [   28.739947] mmc0: Reset 0x1 never completed.
> > [   28.745155] genirq: Flags mismatch irq 8. 0080 (mmc0) vs.  
> > (rtc0)
> 
> mmc driver requests IRQ 8?
> From surface it looks like either a firmware issue or ACPI get the wrong
> IRQ resource.
> I failed to replicate this issue with the attached config file on my
> side, which platform is the test running?

Sorry for late.  The test was running on an ASUS T100TA.

Best Regards,
Huang, Ying

> Thanks,
> -Aubrey
> > [   28.753151] CPU: 1 PID: 138 Comm: systemd-udevd Not tainted 
> > 4.0.0-rc4-wl-03426-gdba586f #1
> > [   28.753156]  880076683480 8800764ffa78 818b2eb3 
> > 0007
> > [   28.753159]  88006d006800 8800764ffad8 810d37af 
> > 8800764ffad8
> > [   28.753162]  0246 810d394a 880053bdc400 
> > 
> > [   28.753163] Call Trace:
> > [   28.753174]  [] dump_stack+0x4c/0x65
> > [   28.753180]  [] __setup_irq+0x57f/0x5d0
> > [   28.753183]  [] ? request_threaded_irq+0xaa/0x1b0
> > [   28.753191]  [] ? sdhci_request+0x200/0x200 [sdhci]
> > [   28.753194]  [] request_threaded_irq+0xf4/0x1b0
> > [   28.753199]  [] sdhci_add_host+0x800/0xf90 [sdhci]
> > [   28.753205]  [] sdhci_acpi_probe+0x348/0x440 
> > [sdhci_acpi]
> > [   28.753210]  [] platform_drv_probe+0x34/0xa0
> > [   28.753215]  [] driver_probe_device+0x90/0x3e0
> > [   28.753218]  [] __driver_attach+0x9b/0xa0
> > [   28.753221]  [] ? __device_attach+0x40/0x40
> > [   28.753231]  [] bus_for_each_dev+0x6b/0xb0
> > [   28.753234]  [] driver_attach+0x1e/0x20
> > [   28.753237]  [] bus_add_driver+0x180/0x250
> > [   28.753240]  [] ? 0xa002e000
> > [   28.753243]  [] driver_register+0x64/0xf0
> > [   28.753246]  [] __platform_driver_register+0x4a/0x50
> > [   28.753250]  [] sdhci_acpi_driver_init+0x17/0x1000 
> > [sdhci_acpi]
> > [   28.753254]  [] do_one_initcall+0xc0/0x1f0
> > [   28.753259]  [] ? kmem_cache_alloc_trace+0x1cc/0x240
> > [   28.753262]  [] ? do_init_module+0x28/0x1dd
> > [   28.753266]  [] do_init_module+0x61/0x1dd
> > [   28.753270]  [] load_module+0x189f/0x1be0
> > [   28.753274]  [] ? store_uevent+0x40/0x40
> > [   28.753279]  [] SyS_finit_module+0x86/0xb0
> > [   28.753283]  [] system_call_fastpath+0x12/0x17
> > [   28.753700] mmc0: Failed to request IRQ 8: -16
> > [   28.975382] IOAPIC[0]: Set routing entry (8-16 -> 0x32 -> IRQ 13 Mode:1 
> > Active:1 Dest:15)
> > [   28.975934] sdhci-acpi: probe of INT33BB:00 failed with error -16
> > 
> > 
> > Thanks,
> > Ying Huang
> > 
> > 
> > 
> > ___
> > LKP mailing list
> > l...@linux.intel.com
> > 
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH] PM / Hiberante : optimize swsusp_free()

2015-03-23 Thread Yeon, JeHyeon (Tom)
I'm sorry not to answer it.
I'm too busy nowadays on my project.
So, I'll add some details later.
Thank you.

-Original Message-
From: Rafael J. Wysocki [mailto:r...@rjwysocki.net] 
Sent: Thursday, March 19, 2015 8:37 PM
To: Tom(JeHyeon) Yeon
Cc: pa...@ucw.cz; BROWN, A LEONARD; jroe...@suse.de; linux...@vger.kernel.org; 
linux-kernel@vger.kernel.org; Yeon, JeHyeon (Tom)
Subject: Re: [PATCH] PM / Hiberante : optimize swsusp_free()

On Thursday, March 19, 2015 05:28:58 PM Tom Yeon wrote:
> From: "Tom(JeHyeon) Yeon" 
> 
> I tested the performance of swsusp_free operation.
> The free time took about 58768us before commit fdd64ed, and
> the free time took about 40535us after the commit fdd64ed.
> 
> But, I optimized the function before I saw commit fdd64ed.
> So, I applied the patch in my system.(ARM Coretex A9, Dual Core 1GHz)
> The free time took about 35164us.
> I think that the finding routine for the same pfn is redundant

This changelog in total pants, sorry.

Please write what the patch is doing and why instead of describing
your testing experience.  The numbers are useful too, but only to
show what the gain is, and you need to explain what is changing and
why.

> Signed-off-by: Tom(JeHyeon) Yeon 
> ---
>  kernel/power/snapshot.c |   43 ++-
>  1 file changed, 10 insertions(+), 33 deletions(-)
> 
> diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
> index c24d5a2..a1ad801 100644
> --- a/kernel/power/snapshot.c
> +++ b/kernel/power/snapshot.c
> @@ -726,14 +726,6 @@ static void memory_bm_clear_bit(struct memory_bitmap 
> *bm, unsigned long pfn)
>   clear_bit(bit, addr);
>  }
>  
> -static void memory_bm_clear_current(struct memory_bitmap *bm)
> -{
> - int bit;
> -
> - bit = max(bm->cur.node_bit - 1, 0);
> - clear_bit(bit, bm->cur.node->data);
> -}
> -
>  static int memory_bm_test_bit(struct memory_bitmap *bm, unsigned long pfn)
>  {
>   void *addr;
> @@ -1342,36 +1334,21 @@ static struct memory_bitmap copy_bm;
>  
>  void swsusp_free(void)
>  {
> - unsigned long fb_pfn, fr_pfn;
> + unsigned long pfn;
>  
>   if (!forbidden_pages_map || !free_pages_map)
>   goto out;
>  
>   memory_bm_position_reset(forbidden_pages_map);
> - memory_bm_position_reset(free_pages_map);
> -
> -loop:
> - fr_pfn = memory_bm_next_pfn(free_pages_map);
> - fb_pfn = memory_bm_next_pfn(forbidden_pages_map);
> -
> - /*
> -  * Find the next bit set in both bitmaps. This is guaranteed to
> -  * terminate when fb_pfn == fr_pfn == BM_END_OF_MAP.
> -  */
> - do {
> - if (fb_pfn < fr_pfn)
> - fb_pfn = memory_bm_next_pfn(forbidden_pages_map);
> - if (fr_pfn < fb_pfn)
> - fr_pfn = memory_bm_next_pfn(free_pages_map);
> - } while (fb_pfn != fr_pfn);
> -
> - if (fr_pfn != BM_END_OF_MAP && pfn_valid(fr_pfn)) {
> - struct page *page = pfn_to_page(fr_pfn);
> -
> - memory_bm_clear_current(forbidden_pages_map);
> - memory_bm_clear_current(free_pages_map);
> - __free_page(page);
> - goto loop;
> + for ( ; ; ) {
> + pfn  = memory_bm_next_pfn(forbidden_pages_map);
> + if (BM_END_OF_MAP == pfn)
> + break;
> + if (memory_bm_test_bit(free_pages_map, pfn)) {

So why exactly isn't it necessary to look at 
memory_bm_next_pfn(forbidden_pages_map)?

> + memory_bm_clear_bit(forbidden_pages_map, pfn);
> + memory_bm_clear_bit(free_pages_map, pfn);
> + __free_page(pfn_to_page(pfn));
> + }
>   }
>  
>  out:
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.


Re: [PATCH v3] perf tools: Work around lack of sched_getcpu in glibc < 2.6.

2015-03-23 Thread Namhyung Kim
Hi Vinson,

On Mon, Mar 23, 2015 at 12:09:16PM -0700, Vinson Lee wrote:
> From: Vinson Lee 
> 
> This patch fixes this build error with glibc < 2.6.
> 
>   CC   util/cloexec.o
> cc1: warnings being treated as errors
> util/cloexec.c: In function ‘perf_flag_probe’:
> util/cloexec.c:24: error: implicit declaration of function
> ‘sched_getcpu’
> util/cloexec.c:24: error: nested extern declaration of ‘sched_getcpu’
> make: *** [util/cloexec.o] Error 1
> 
> Cc: sta...@vger.kernel.org # 3.18+
> Signed-off-by: Vinson Lee 

Acked-by: Namhyung Kim 

Thanks,
Namhyung


> ---
>  tools/perf/util/cloexec.c | 6 ++
>  tools/perf/util/cloexec.h | 6 ++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/tools/perf/util/cloexec.c b/tools/perf/util/cloexec.c
> index 6da965b..85b5238 100644
> --- a/tools/perf/util/cloexec.c
> +++ b/tools/perf/util/cloexec.c
> @@ -7,6 +7,12 @@
>  
>  static unsigned long flag = PERF_FLAG_FD_CLOEXEC;
>  
> +int __weak sched_getcpu(void)
> +{
> + errno = ENOSYS;
> + return -1;
> +}
> +
>  static int perf_flag_probe(void)
>  {
>   /* use 'safest' configuration as used in perf_evsel__fallback() */
> diff --git a/tools/perf/util/cloexec.h b/tools/perf/util/cloexec.h
> index 94a5a7d..6c2 100644
> --- a/tools/perf/util/cloexec.h
> +++ b/tools/perf/util/cloexec.h
> @@ -3,4 +3,10 @@
>  
>  unsigned long perf_event_open_cloexec_flag(void);
>  
> +#ifdef __GLIBC_PREREQ
> +#if !__GLIBC_PREREQ(2, 6)
> +extern int sched_getcpu(void) __THROW;
> +#endif
> +#endif
> +
>  #endif /* __PERF_CLOEXEC_H */
> -- 
> 1.8.2.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   3   4   5   6   7   8   9   10   >