[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN v2] xen/arm: arm32: Use adr_l instead of load_paddr for getting address of symbols


  • To: Julien Grall <julien@xxxxxxx>, Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Thu, 26 Oct 2023 15:41:20 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=xen.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Jpf63Ghrqv+2EEV7KDj6pk+VhyGTFkL8j3vsiqiLCSM=; b=eCGq8VxCllPdhUu6FMJtf3w5HLVrkIu79mXEEJVcsUiCWuEaj45mdZOnGuRkMS+g0Yjnb2NA2gzO8r1PapvaveF/JR+Eh3j4jgCn33Je7iORre5nAF2f0PMmSoR4mhzQ/epp0uj/p78KAIAmXP7dVyFD4z12NfzwVRcEROlOf+SdJLxrITor0qM6JlQMrb45oZ8fNcMZLnhE7zQin548ZgMMWeR5P0pCVa1DBksf9eQtrz5xO4/6Ac3eqfJw9PvU34sVdvKYMiva3HRxXrQDdBF7YaRx/C6pYiNdA/tumv+MFYc+l0+eMbtknMtr5mQwayXd4Sfjkt8DG9p6+Dpx+w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lmyP3rwImQD6UCVUEP41mg+jANY0Ehy7kotG08v2Jrm+HdWRyPq0+hjdekdNfxV/gCL30je7ftguS0i50Af4PMbsHqtf23W6qa9P1+EnM3cV9UckYBQi1XCM8ifMq8Mr9YRr7Y4M0Fxg+1a9iEzDVZZulasQxMS8VCMwHK6bZgnt6NwcbQiBjSo7l3CVvBiv9QuXDGad/4ZCfsEyYZBoSm6nRK1VO/9o5UJcq0UCrujEatMLw4k/eWIn/NL6OBlMn+TUAbsYcAuHFLdYqaV+1u7uxdbQonPXjtU2HF90jjrkBJmdiZI0lzBan9BnU8ZLt1QpJdV4lj4zo6793dbZKg==
  • Cc: <sstabellini@xxxxxxxxxx>, <bertrand.marquis@xxxxxxx>
  • Delivery-date: Thu, 26 Oct 2023 13:41:37 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Ayan,

On 26/10/2023 13:19, Julien Grall wrote:
> 
> 
> Hi,
> 
> Title: This reads as you replace all adr_l with load_paddr. So how about:
> 
> xen/arm32: head: Replace load_paddr with adr_l when they are equivalent
> 
> On 26/10/2023 12:12, Ayan Kumar Halder wrote:
>> Before the MMU is turned on, PC uses physical address. Thus, one can use 
>> adr_l
>> instead of load_paddr to obtain the physical address of a symbol.
>>
>> The only exception (for this replacement) is create_table_entry() which is
>> called before and after MMU is turned on.
>>
>> Also, in lookup_processor_type() "r10" is no longer used. The reason being
>> __lookup_processor_type uses adr_l (thus r10 is no longer used to obtain the
>> physical address offset).
>>
>> Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
>> ---
>> Refer https://lists.archive.carbon60.com/xen/devel/682900 for details.
>>
>> Changes from :-
>>
>> v1 :- 1. No need to modify create_table_entry().
>> 2. Remove "mov   r10, #0 " in lookup_processor_type().
>>
>>   xen/arch/arm/arm32/head.S | 13 ++++++-------
>>   1 file changed, 6 insertions(+), 7 deletions(-)
>>

[...]
>>   /* This provides a C-API version of __lookup_processor_type */
>>   ENTRY(lookup_processor_type)
>>           stmfd sp!, {r4, r10, lr}
> 
> Do we still need to save/restore r10?
Apart from this remark...

> 
>> -        mov   r10, #0                   /* r10 := offset between virt&phys 
>> */
>>           bl    __lookup_processor_type
>>           mov r0, r1
>>           ldmfd sp!, {r4, r10, pc}
>> @@ -897,8 +896,8 @@ ENTRY(lookup_processor_type)
>>    */
there is also a comment here listing r10 as the register in use and explaining
the need to calculate the offset. This should be tweaked as well (r10 is no 
longer in use
and we don't care if we are running before or after MMU is on, since adr_l will 
always get us
the address in the current address space which is what we expect (before MMU - 
physical, after MMU - virtual).

>>   __lookup_processor_type:
>>           mrc   CP32(r0, MIDR)                /* r0 := our cpu id */
>> -        load_paddr r1, __proc_info_start
>> -        load_paddr r2, __proc_info_end
>> +        adr_l r1, __proc_info_start
>> +        adr_l r2, __proc_info_end
>>   1:      ldr   r3, [r1, #PROCINFO_cpu_mask]
>>           and   r4, r0, r3                    /* r4 := our cpu id with mask 
>> */
>>           ldr   r3, [r1, #PROCINFO_cpu_val]   /* r3 := cpu val in current 
>> proc info */
> 
> Cheers,
> 
> --
> Julien Grall

~Michal



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.