Re: clk: Two-output clk provider with standard clk consumer

2015-10-19 Thread Mason
On 13/10/2015 14:30, Mason wrote:

> So the device tree would look like this:
> 
>   clocks {
>   ranges;
>   #address-cells = <1>;
>   #size-cells = <1>;
> 
>   xtal: xtal {
>   compatible = "fixed-clock";
>   clock-frequency = <2700>;
>   #clock-cells = <0>;
>   };
> 
>   clkgen: clkgen@1 {
>   compatible = "foo,clkgen";
>   reg = <0x1 0x30>;
>   clocks = <&xtal>;
>   #clock-cells = <1>;

Missing clock-output-names property here.

>   };
> 
>   periphclk: periphclk {
>   compatible = "fixed-factor-clock";
>   clocks = <&clkgen 0>;
>   clock-mult = <1>;
>   clock-div  = <2>;
>   #clock-cells = <0>;
>   };
>   };

Sorry for the noise.


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Enable/disable cpu

2015-10-19 Thread Bjørn Mork
Doug Wilson  writes:

> All,
>
>   I have been looking at sysfs cpu side code. Had a quick question.
>
> On my x86 box:
> #ls /sys/devices/system/cpu/
> I see 4 cpus plus a few more fields such as online/present/possible etc.
>
> This come from drivers/base/cpu.c.
>
> My question here is, in each of those cpu0-3 folders, there's file by name
> online which one can use to disable/enable cpu using cpumask. Could
> someone point me to that code, I could not really pin point to where exactly
> this attribute is defined. Am just exploring cpu hotplug feature.


drivers/base/core.c has this generic code for creating that file:

if (device_supports_offline(dev) && !dev->offline_disabled) {
error = device_create_file(dev, &dev_attr_online);
if (error)
goto err_remove_dev_groups;
}


where device_supports_offline is:

static inline bool device_supports_offline(struct device *dev)
{
return dev->bus && dev->bus->offline && dev->bus->online;
}

and the cpu "bus" is (from drivers/base/cpu.c):

struct bus_type cpu_subsys = {
.name = "cpu",
.dev_name = "cpu",
.match = cpu_subsys_match,
#ifdef CONFIG_HOTPLUG_CPU
.online = cpu_subsys_online,
.offline = cpu_subsys_offline,
#endif
};


The fields of the cpu device are initialized in drivers/base/cpu.c:


int register_cpu(struct cpu *cpu, int num)
{
int error;

cpu->node_id = cpu_to_node(num);
memset(&cpu->dev, 0x00, sizeof(struct device));
cpu->dev.id = num;
cpu->dev.bus = &cpu_subsys;
cpu->dev.release = cpu_device_release;
cpu->dev.offline_disabled = !cpu->hotpluggable;
cpu->dev.offline = !cpu_online(num);
cpu->dev.of_node = of_get_cpu_node(num, NULL);
#ifdef CONFIG_GENERIC_CPU_AUTOPROBE
cpu->dev.bus->uevent = cpu_uevent;
#endif
cpu->dev.groups = common_cpu_attr_groups;
if (cpu->hotpluggable)
cpu->dev.groups = hotplugable_cpu_attr_groups;
error = device_register(&cpu->dev);
if (!error)
per_cpu(cpu_sys_devices, num) = &cpu->dev;
if (!error)
register_cpu_under_node(num, cpu_to_node(num));

return error;
}


So you get the "online" file in the cpuX folders when CONFIG_HOTPLUG_CPU
is defined and cpu->hotpluggable is true.  Which will exclude cpu0 in
some cases. See arch/x86/kernel/topology.c for the x86 specific logic
concerning that.  I assume other platforms have similar exceptions


Bjørn

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: System freezes with Kernel BUG at kernel/time/timer.c:1108 run_timer_softirq()

2015-10-19 Thread Mulyadi Santosa
On Wed, Oct 14, 2015 at 11:02 AM, Raghavendra. S
 wrote:
>
> Hi,
>
>   In my x86 laptop I could observe random panic with Fatal exception in 
> interrupt. We are testing Wi-Fi with our own driver issue occur randomly 
> after 2-3 hours of testing.
>
>   Panic is due to fatal except in interrupt and Kernel stack trace is  
> run_timer_softirq()->__run_timers()->cascade()->BUG_ON(tbase_get_base(timer->base)
>  != base);
>
>
>
>
>
>   Any pointers to debug this will be of great help.
>
>
> -Raghu
>
First of all, please send email using plain text mode. If you need to
send picture, better attach it to somewhere else and provide us with
the link.

I am just guessing:
it might be that when timer is about to run or in the middle of
running, the data structure that represents the timer gets deleted.

Sounds like race condition then.

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to reserve physical address space region

2015-10-19 Thread Mulyadi Santosa
On Fri, Oct 16, 2015 at 10:53 AM, sahlot arvind  wrote:
> Hi,
>
> Is there an API kernel exposes to use for a driver in order to reserve
> physical address space?
> I mean I want to reserve 5GB (or more if allowed) of contiguous physical
> address space anywhere in the address range (wherever it is available..
> doesn't matter) and then I want to map that physical address range in the
> kernel to get a virtual address so that my driver can dereference that
> virtual pointer to access the mapped physical address range.
>
> Thanks in advance!
> Sahlot
>

5 GB is alot. If you are sure about it, then I guess boot_memalloc()
might be the only choice


-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to reserve physical address space region

2015-10-19 Thread Kenneth Adam Miller
Have you looked at the uio driver examples?

Also, LDD3 may be old, but the API is at least still relevant. The
explanation is too long to include here, but the book is free :D

On Thu, Oct 15, 2015 at 11:53 PM, sahlot arvind  wrote:

> Hi,
>
> Is there an API kernel exposes to use for a driver in order to reserve
> physical address space?
> I mean I want to reserve 5GB (or more if allowed) of contiguous physical
> address space anywhere in the address range (wherever it is available..
> doesn't matter) and then I want to map that physical address range in the
> kernel to get a virtual address so that my driver can dereference that
> virtual pointer to access the mapped physical address range.
>
> Thanks in advance!
> Sahlot
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Enable/disable cpu

2015-10-19 Thread Doug Wilson
All,

  I have been looking at sysfs cpu side code. Had a quick question.

On my x86 box:
#ls /sys/devices/system/cpu/
I see 4 cpus plus a few more fields such as online/present/possible etc.

This come from drivers/base/cpu.c.

My question here is, in each of those cpu0-3 folders, there's file by name
online which one can use to disable/enable cpu using cpumask. Could
someone point me to that code, I could not really pin point to where exactly
this attribute is defined. Am just exploring cpu hotplug feature.

Thanks.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


How to reserve physical address space region

2015-10-19 Thread sahlot arvind
Hi,

Is there an API kernel exposes to use for a driver in order to reserve
physical address space?
I mean I want to reserve 5GB (or more if allowed) of contiguous physical
address space anywhere in the address range (wherever it is available..
doesn't matter) and then I want to map that physical address range in the
kernel to get a virtual address so that my driver can dereference that
virtual pointer to access the mapped physical address range.

Thanks in advance!
Sahlot
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies