Message ID | 20150210080002.GA23291@cumulusnetworks.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
On Tue, 2015-02-10 at 00:00 -0800, Dave Olson wrote: > > OK, now that I understand that's the case, I'll have to go back and > re-do the patch to handle both cache-size and d-cache-size for the > L2 cache (using whichever is present). I notice that you also didn't modify all the other properties, I would assume you need to also updates in that area ? Maybe you should duplicate the whole structure and have the code look for both. > I don't have any power Macs to use for testing, would one of you be > willing and able to verify the patch on a power Mac? > > The patch below fixes my problem, and I don't think it will break > platforms like the PowerPC Mac that use d-cache-size
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote: > On Tue, 2015-02-10 at 00:00 -0800, Dave Olson wrote: > > > > OK, now that I understand that's the case, I'll have to go back and > > re-do the patch to handle both cache-size and d-cache-size for the > > L2 cache (using whichever is present). > > I notice that you also didn't modify all the other properties, I would > assume you need to also updates in that area ? Maybe you should > duplicate the whole structure and have the code look for both. Since we have line_size_props, I can bump that from 2 to 4 entries, and add "cache_line_size" and "cache_block_size", instead of an explict check. I could change size_prop, and nr_sets_prop to be a structure like line_size_props, if you think that's cleaner than the explict check for "cache-size", and "cache-sets" in the functions. These 3 seem to be the only ones at issue, and I should have checked futher to realize that sets and line size were missing. What's the preference for the other 2 missing items? > > I don't have any power Macs to use for testing, would one of you be > > willing and able to verify the patch on a power Mac? Dave Olson olson@cumulusnetworks.com
On Tue, 2015-02-10 at 08:55 -0800, Dave Olson wrote: > Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote: > > > On Tue, 2015-02-10 at 00:00 -0800, Dave Olson wrote: > > > > > > OK, now that I understand that's the case, I'll have to go back and > > > re-do the patch to handle both cache-size and d-cache-size for the > > > L2 cache (using whichever is present). > > > > I notice that you also didn't modify all the other properties, I would > > assume you need to also updates in that area ? Maybe you should > > duplicate the whole structure and have the code look for both. > > Since we have line_size_props, I can bump that from 2 to 4 > entries, and add "cache_line_size" and "cache_block_size", > instead of an explict check. > > I could change size_prop, and nr_sets_prop to be a structure like > line_size_props, if you think that's cleaner than the explict > check for "cache-size", and "cache-sets" in the functions. > > These 3 seem to be the only ones at issue, and I should have checked > futher to realize that sets and line size were missing. > > What's the preference for the other 2 missing items? Up to you, but I'm thinking at this point, isn't it worth duplicating the whole struct and using which ever matches on the first entry ? > > > I don't have any power Macs to use for testing, would one of you be > > > willing and able to verify the patch on a power Mac? > > Dave Olson > olson@cumulusnetworks.com
===== diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c index a3c684b..0d1f879 100644 --- a/arch/powerpc/kernel/cacheinfo.c +++ b/arch/powerpc/kernel/cacheinfo.c @@ -200,6 +200,10 @@ static int cache_size(const struct cache *cache, unsigned int *ret) propname = cache_type_info[cache->type].size_prop; cache_size = of_get_property(cache->ofnode, propname, NULL); + if (!cache_size && cache->type == CACHE_TYPE_UNIFIED) { + /* most embedded systems with L2 use "cache-size", allow that also */ + cache_size = of_get_property(cache->ofnode, "cache-size", NULL); + } if (!cache_size) return -ENODEV;