All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robherring2@gmail.com>
To: Stephen Boyd <sboyd@codeaurora.org>
Cc: Russell King <linux@arm.linux.org.uk>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	Rob Herring <rob.herring@calxeda.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Stephen Warren <swarren@nvidia.com>
Subject: Re: [PATCH] ARM: mmu: Add debug_ll_io_init() mappings to early mappings
Date: Fri, 14 Jun 2013 08:08:42 -0500	[thread overview]
Message-ID: <51BB15DA.8020302@gmail.com> (raw)
In-Reply-To: <20130612172146.GB10823@codeaurora.org>

On 06/12/2013 12:21 PM, Stephen Boyd wrote:
> On 06/11, Rob Herring wrote:
>> On Tue, Jun 11, 2013 at 8:30 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:
>>
>>> diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
>>> index e0d8565..04fe160 100644
>>> --- a/arch/arm/mm/mmu.c
>>> +++ b/arch/arm/mm/mmu.c
>>> @@ -938,8 +938,12 @@ static void __init pci_reserve_io(void)
>>>  #ifdef CONFIG_DEBUG_LL
>>>  void __init debug_ll_io_init(void)
>>>  {
>>> +       struct vm_struct *vm;
>>> +       struct static_vm *svm;
>>>         struct map_desc map;
>>>
>>> +       svm = early_alloc_aligned(sizeof(*svm), __alignof__(*svm));
>>> +
>>>         debug_ll_addr(&map.pfn, &map.virtual);
>>>         if (!map.pfn || !map.virtual)
>>>                 return;
>>> @@ -948,6 +952,15 @@ void __init debug_ll_io_init(void)
>>>         map.length = PAGE_SIZE;
>>>         map.type = MT_DEVICE;
>>>         create_mapping(&map);
>>> +
>>> +       vm = &svm->vm;
>>> +       vm->addr = (void *)map.virtual;
>>> +       vm->size = map.length;
>>> +       vm->phys_addr = __pfn_to_phys(map.pfn);
>>> +       vm->flags = VM_IOREMAP | VM_ARM_STATIC_MAPPING;
>>> +       vm->flags |= VM_ARM_MTYPE(map.type);
>>> +       vm->caller = debug_ll_io_init;
>>> +       add_static_vm_early(svm);
>>
>> Can you use vm_reserve_area_early here or perhaps just call
>> iotable_init instead of create_mapping directly? I don't recall if
>> there was some reason I didn't do that.
>>
> 
> I had iotable_init() before but I thought it was better to have
> the ->caller argument say debug_ll_io_init() instead of
> iotable_init(). Shall I extract out the similar code?

Well, that's always welcome...

Another option would be use __builtin_return_address. That would change
vmallocinfo from showing iotable_init to the caller of iotable_init.
Arguably, knowing the caller would be better.

Rob

WARNING: multiple messages have this Message-ID (diff)
From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: mmu: Add debug_ll_io_init() mappings to early mappings
Date: Fri, 14 Jun 2013 08:08:42 -0500	[thread overview]
Message-ID: <51BB15DA.8020302@gmail.com> (raw)
In-Reply-To: <20130612172146.GB10823@codeaurora.org>

On 06/12/2013 12:21 PM, Stephen Boyd wrote:
> On 06/11, Rob Herring wrote:
>> On Tue, Jun 11, 2013 at 8:30 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:
>>
>>> diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
>>> index e0d8565..04fe160 100644
>>> --- a/arch/arm/mm/mmu.c
>>> +++ b/arch/arm/mm/mmu.c
>>> @@ -938,8 +938,12 @@ static void __init pci_reserve_io(void)
>>>  #ifdef CONFIG_DEBUG_LL
>>>  void __init debug_ll_io_init(void)
>>>  {
>>> +       struct vm_struct *vm;
>>> +       struct static_vm *svm;
>>>         struct map_desc map;
>>>
>>> +       svm = early_alloc_aligned(sizeof(*svm), __alignof__(*svm));
>>> +
>>>         debug_ll_addr(&map.pfn, &map.virtual);
>>>         if (!map.pfn || !map.virtual)
>>>                 return;
>>> @@ -948,6 +952,15 @@ void __init debug_ll_io_init(void)
>>>         map.length = PAGE_SIZE;
>>>         map.type = MT_DEVICE;
>>>         create_mapping(&map);
>>> +
>>> +       vm = &svm->vm;
>>> +       vm->addr = (void *)map.virtual;
>>> +       vm->size = map.length;
>>> +       vm->phys_addr = __pfn_to_phys(map.pfn);
>>> +       vm->flags = VM_IOREMAP | VM_ARM_STATIC_MAPPING;
>>> +       vm->flags |= VM_ARM_MTYPE(map.type);
>>> +       vm->caller = debug_ll_io_init;
>>> +       add_static_vm_early(svm);
>>
>> Can you use vm_reserve_area_early here or perhaps just call
>> iotable_init instead of create_mapping directly? I don't recall if
>> there was some reason I didn't do that.
>>
> 
> I had iotable_init() before but I thought it was better to have
> the ->caller argument say debug_ll_io_init() instead of
> iotable_init(). Shall I extract out the similar code?

Well, that's always welcome...

Another option would be use __builtin_return_address. That would change
vmallocinfo from showing iotable_init to the caller of iotable_init.
Arguably, knowing the caller would be better.

Rob

  reply	other threads:[~2013-06-14 13:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-12  1:30 [PATCH] ARM: mmu: Add debug_ll_io_init() mappings to early mappings Stephen Boyd
2013-06-12  1:30 ` Stephen Boyd
2013-06-12  3:37 ` Rob Herring
2013-06-12  3:37   ` Rob Herring
2013-06-12 17:21   ` Stephen Boyd
2013-06-12 17:21     ` Stephen Boyd
2013-06-14 13:08     ` Rob Herring [this message]
2013-06-14 13:08       ` Rob Herring
2013-06-14 16:45       ` Stephen Boyd
2013-06-14 16:45         ` Stephen Boyd
2013-06-14 18:00         ` Stephen Boyd
2013-06-14 18:00           ` Stephen Boyd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51BB15DA.8020302@gmail.com \
    --to=robherring2@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=rob.herring@calxeda.com \
    --cc=sboyd@codeaurora.org \
    --cc=swarren@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.