mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
	Ahmad Fatoum <a.fatoum@barebox.org>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 07/15] efi: types: implement efi_phys_to_virt/efi_virt_to_phys helpers
Date: Mon, 2 Jun 2025 14:14:36 +0200	[thread overview]
Message-ID: <8d27b9f5-7b0d-4489-884b-38339adb0fec@pengutronix.de> (raw)
In-Reply-To: <aD2VWAhkaVs9txjY@pengutronix.de>

Hi,

On 6/2/25 14:13, Sascha Hauer wrote:
> On Tue, May 27, 2025 at 11:22:52PM +0200, Ahmad Fatoum wrote:
>> From: Ahmad Fatoum <ahmad@a3f.at>
>>
>> We shouldn't have any physical addresses exceeding 32-bit on 64-bit
>> systems,
> 
> Why? Aren't 64bit physical addresses normal on 64bit systems?

Sorry, other way round. We shouldn't have 64-bit addresses on 32-bit
systems.

> 
>> especially as barebox doesn't implement ARM32 LPAE.
> 
> This patch doesn't seem to be Arm specific, so why mention ARM32 LPAE
> here?
> 
> I think I am missing something here.

Sorry for the Switcharoo. Can you fixup or should I resend?

Thanks,
Ahmad

> 
> Sascha
> 
>>
>> Add helpers to convert between the types to be able to drop casts and
>> checks in the code.
>>
>> Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
>> ---
>>  include/efi/types.h | 17 +++++++++++++++++
>>  1 file changed, 17 insertions(+)
>>
>> diff --git a/include/efi/types.h b/include/efi/types.h
>> index c845d08d62b6..85aaf32f8f1d 100644
>> --- a/include/efi/types.h
>> +++ b/include/efi/types.h
>> @@ -2,7 +2,11 @@
>>  #ifndef _EFI_TYPES_H_
>>  #define _EFI_TYPES_H_
>>  
>> +#ifndef __ASSEMBLY__
>> +
>>  #include <linux/types.h>
>> +#include <linux/limits.h>
>> +#include <linux/stddef.h>
>>  #include <linux/compiler.h>
>>  #include <linux/uuid.h>
>>  
>> @@ -65,4 +69,17 @@ union efi_ip_address {
>>  	struct efi_ipv6_address v6;
>>  };
>>  
>> +static inline void *efi_phys_to_virt(efi_physical_addr_t addr)
>> +{
>> +	if (addr > UINTPTR_MAX)
>> +		__builtin_trap();
>> +
>> +	return (void *)(uintptr_t)addr;
>> +}
>> +
>> +static inline efi_physical_addr_t efi_virt_to_phys(const void *addr)
>> +{
>> +	return (uintptr_t)addr;
>> +}
>> +
>>  #endif
>> -- 
>> 2.39.5
>>
>>
>>
> 

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




  reply	other threads:[~2025-06-02 12:15 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-27 21:22 [PATCH 00/15] efi: loader preparatory patches Ahmad Fatoum
2025-05-27 21:22 ` [PATCH 01/15] lib: wchar: add wide char string comparison functions Ahmad Fatoum
2025-05-27 21:22 ` [PATCH 02/15] ARM: select HW_HAS_PCI architecture wide Ahmad Fatoum
2025-05-27 21:22 ` [PATCH 03/15] efi: types: define efi_char16_t as wchar_t Ahmad Fatoum
2025-05-27 21:22 ` [PATCH 04/15] efi: types: document efi_physical_addr_t being always 64-bit Ahmad Fatoum
2025-05-27 21:22 ` [PATCH 05/15] efi: payload: early-mem: EFI_ALLOCATE_ANY_PAGES on non-x86 Ahmad Fatoum
2025-05-27 21:22 ` [PATCH 06/15] string: implement kmemdup_nul Ahmad Fatoum
2025-05-27 21:22 ` [PATCH 07/15] efi: types: implement efi_phys_to_virt/efi_virt_to_phys helpers Ahmad Fatoum
2025-06-02 12:13   ` Sascha Hauer
2025-06-02 12:14     ` Ahmad Fatoum [this message]
2025-06-02 12:25       ` Sascha Hauer
2025-05-27 21:22 ` [PATCH 08/15] efi: return pointer from efi_earlymem_alloc Ahmad Fatoum
2025-05-27 21:22 ` [PATCH 09/15] efi: payload: image: use new efi_phys_to_virt helper Ahmad Fatoum
2025-05-27 21:22 ` [PATCH 10/15] efi: payload: iomem: use virt_start if set Ahmad Fatoum
2025-05-27 21:22 ` [PATCH 11/15] efi: use size_t for UINTN array sizes instead of unsigned long Ahmad Fatoum
2025-05-27 21:22 ` [PATCH 12/15] efi: payload: unify duplicate code in ifdef Ahmad Fatoum
2025-05-27 21:22 ` [PATCH 13/15] efi: payload: use efi_virt_to_phys instead of pointer to u64 casts Ahmad Fatoum
2025-05-27 21:22 ` [PATCH 14/15] clocksource: efi: use DIV_ROUND_DOWN_ULL for 64-bit devision Ahmad Fatoum
2025-05-27 21:23 ` [PATCH 15/15] efi: payload: use ktime_to_us to avoid plain 64-bit division Ahmad Fatoum
2025-06-02 12:24 ` [PATCH 00/15] efi: loader preparatory patches Sascha Hauer

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=8d27b9f5-7b0d-4489-884b-38339adb0fec@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=a.fatoum@barebox.org \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox