All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Ayan Kumar Halder <ayankuma@amd.com>,
	Ayan Kumar Halder <ayan.kumar.halder@amd.com>
Cc: sstabellini@kernel.org, stefano.stabellini@amd.com,
	julien@xen.org, Volodymyr_Babchuk@epam.com,
	bertrand.marquis@arm.com, andrew.cooper3@citrix.com,
	george.dunlap@citrix.com, wl@xen.org, rahul.singh@arm.com,
	xen-devel@lists.xenproject.org
Subject: Re: [XEN v4 07/11] xen/arm: Introduce choice to enable 64/32 bit physical addressing
Date: Wed, 22 Mar 2023 07:59:29 +0100	[thread overview]
Message-ID: <205658ff-e0ac-1656-2d12-099abd891fcd@suse.com> (raw)
In-Reply-To: <01a800a5-1c0d-b9d4-05c7-c886b3e3009d@amd.com>

On 21.03.2023 19:33, Ayan Kumar Halder wrote:
> On 21/03/2023 16:53, Jan Beulich wrote:
>> On 21.03.2023 17:15, Ayan Kumar Halder wrote:
>>> On 21/03/2023 14:22, Jan Beulich wrote:
>>>> (Using "unsigned long" for a 32-bit paddr_t is of
>>>> course suspicious as well - this ought to be uint32_t.)
>>> The problem with using uint32_t for paddr_t is that there are instances
>>> where the paddr_t is modified with PAGE_MASK or PAGE_ALIGN.
>>>
>>> For eg , handle_passthrough_prop()
>>>
>>>               printk(XENLOG_ERR "Unable to permit to dom%d access to"
>>>                      " 0x%"PRIpaddr" - 0x%"PRIpaddr"\n",
>>>                      kinfo->d->domain_id,
>>>                      mstart & PAGE_MASK, PAGE_ALIGN(mstart + size) - 1);
>>>
>>> And in xen/include/xen/page-size.h,
>>>
>>> #define PAGE_SIZE           (_AC(1,L) << PAGE_SHIFT)
>>> #define PAGE_MASK           (~(PAGE_SIZE-1))
>>>
>>> Thus, the resulting types are unsigned long. This cannot be printed
>>> using %u for PRIpaddr.
>> Is there anything wrong with making PAGE_SIZE expand to (1 << PAGE_SHIFT)
>> when physical addresses are only 32 bits wide?
> 
> I don't have a strong objection except that this is similar to what 
> linux is doing today.
> 
> https://elixir.bootlin.com/linux/latest/source/arch/arm/include/asm/page.h#L12
> 
>>
>>> I remember some discussion (or comment) that the physical addresses
>>> should be represented using 'unsigned long'.
>> A reference would be helpful.
> 
> https://lists.xenproject.org/archives/html/xen-devel/2023-02/msg00305.html

I see. I guess this will be okay as long as only 32-bit arches elect to
use 32-bit physical addresses. Maybe there should be a BUILD_BUG_ON()
somewhere, accompanied by a suitable comment?

Jan


  reply	other threads:[~2023-03-22  6:59 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-21 14:03 [XEN v4 00/11] Add support for 32 bit physical address Ayan Kumar Halder
2023-03-21 14:03 ` [XEN v4 01/11] xen/arm: Use the correct format specifier Ayan Kumar Halder
2023-03-30 19:58   ` Julien Grall
2023-03-21 14:03 ` [XEN v4 02/11] xen/arm: domain_build: Track unallocated pages using the frame number Ayan Kumar Halder
2023-03-30 20:44   ` Julien Grall
2023-03-21 14:03 ` [XEN v4 03/11] xen/arm: Typecast the DT values into paddr_t Ayan Kumar Halder
2023-03-30 21:10   ` Julien Grall
2023-03-21 14:03 ` [XEN v4 04/11] xen/drivers: ns16550: Use paddr_t for io_base/io_size Ayan Kumar Halder
2023-03-21 14:16   ` Jan Beulich
2023-03-29 14:35     ` Ayan Kumar Halder
2023-03-30  6:55       ` Jan Beulich
2023-07-07 11:37         ` Ayan Kumar Halder
2023-03-21 14:03 ` [XEN v4 05/11] xen/arm: Introduce a wrapper for dt_device_get_address() to handle paddr_t Ayan Kumar Halder
2023-03-30 21:24   ` Julien Grall
2023-03-21 14:03 ` [XEN v4 06/11] xen/arm: smmu: Use writeq_relaxed_non_atomic() for writing to SMMU_CBn_TTBR0 Ayan Kumar Halder
2023-03-30 21:27   ` Julien Grall
2023-04-03 12:49     ` Ayan Kumar Halder
2023-03-21 14:03 ` [XEN v4 07/11] xen/arm: Introduce choice to enable 64/32 bit physical addressing Ayan Kumar Halder
2023-03-21 14:22   ` Jan Beulich
2023-03-21 16:15     ` Ayan Kumar Halder
2023-03-21 16:53       ` Jan Beulich
2023-03-21 18:33         ` Ayan Kumar Halder
2023-03-22  6:59           ` Jan Beulich [this message]
2023-03-22 13:29             ` Julien Grall
2023-03-22 13:53               ` Jan Beulich
2023-03-27 11:46                 ` Ayan Kumar Halder
2023-03-27 13:30                   ` Julien Grall
2023-03-21 14:03 ` [XEN v4 08/11] xen/arm: guest_walk: LPAE specific bits should be enclosed within "ifndef CONFIG_PHYS_ADDR_T_32" Ayan Kumar Halder
2023-03-21 14:03 ` [XEN v4 09/11] xen/arm: Restrict zeroeth_table_offset for ARM_64 Ayan Kumar Halder
2023-03-30 21:34   ` Julien Grall
2023-03-21 14:03 ` [XEN v4 10/11] xen/arm: p2m: Use the pa_range_info table to support Arm_32 and Arm_64 Ayan Kumar Halder
2023-03-30 21:39   ` Julien Grall
2023-03-30 21:47   ` Julien Grall
2023-03-21 14:03 ` [XEN v4 11/11] xen/arm: p2m: Enable support for 32bit IPA for ARM_32 Ayan Kumar Halder
2023-03-30 21:45   ` Julien Grall
2023-04-04 10:38     ` Ayan Kumar Halder

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=205658ff-e0ac-1656-2d12-099abd891fcd@suse.com \
    --to=jbeulich@suse.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ayan.kumar.halder@amd.com \
    --cc=ayankuma@amd.com \
    --cc=bertrand.marquis@arm.com \
    --cc=george.dunlap@citrix.com \
    --cc=julien@xen.org \
    --cc=rahul.singh@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=stefano.stabellini@amd.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /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.