All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Cc: "Romain Caritey" <Romain.Caritey@microchip.com>,
	"Julien Grall" <julien@xen.org>,
	"Bertrand Marquis" <bertrand.marquis@arm.com>,
	"Michal Orzel" <michal.orzel@amd.com>,
	"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Anthony PERARD" <anthony.perard@vates.tech>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	xen-devel@lists.xenproject.org,
	"Stefano Stabellini" <sstabellini@kernel.org>
Subject: Re: [PATCH v1 5/6] xen: move domain_use_host_layout() to common header
Date: Wed, 18 Feb 2026 14:12:04 +0100	[thread overview]
Message-ID: <0c0061ab-acdb-4ceb-92e2-ca4e591ee741@suse.com> (raw)
In-Reply-To: <5eb4ba3b-f7b6-4cfb-ab67-60198c3f8572@gmail.com>

On 18.02.2026 13:58, Oleksii Kurochko wrote:
> 
> On 2/17/26 8:34 AM, Jan Beulich wrote:
>> On 16.02.2026 19:42, Stefano Stabellini wrote:
>>> On Mon, 16 Feb 2026, Jan Beulich wrote:
>>>> On 12.02.2026 17:21, Oleksii Kurochko wrote:
>>>>> domain_use_host_layout() is generic enough to be moved to the
>>>>> common header xen/domain.h.
>>>> Maybe, but then something DT-specific, not xen/domain.h. Specifically, ...
>>>>
>>>>> --- a/xen/include/xen/domain.h
>>>>> +++ b/xen/include/xen/domain.h
>>>>> @@ -62,6 +62,22 @@ void domid_free(domid_t domid);
>>>>>   #define is_domain_direct_mapped(d) ((d)->cdf & CDF_directmap)
>>>>>   #define is_domain_using_staticmem(d) ((d)->cdf & CDF_staticmem)
>>>>>   
>>>>> +/*
>>>>> + * Is the domain using the host memory layout?
>>>>> + *
>>>>> + * Direct-mapped domain will always have the RAM mapped with GFN == MFN.
>>>>> + * To avoid any trouble finding space, it is easier to force using the
>>>>> + * host memory layout.
>>>>> + *
>>>>> + * The hardware domain will use the host layout regardless of
>>>>> + * direct-mapped because some OS may rely on a specific address ranges
>>>>> + * for the devices.
>>>>> + */
>>>>> +#ifndef domain_use_host_layout
>>>>> +# define domain_use_host_layout(d) (is_domain_direct_mapped(d) || \
>>>>> +                                    is_hardware_domain(d))
>>>> ... is_domain_direct_mapped() isn't something that I'd like to see further
>>>> proliferate in common (non-DT) code.
>>> Hi Jan, we have a requirement for 1:1 mapped Dom0 (I should say hardware
>>> domain) on x86 as well. In fact, we already have a working prototype,
>>> although it is not suitable for upstream yet.
>>>
>>> In addition to the PSP use case that we discussed a few months ago,
>>> where the PSP is not behind an IOMMU and therefore exchanged addresses
>>> must be 1:1 mapped, we also have a new use case. We are running the full
>>> Xen-based automotive stack on an Azure instance where SVM (vmentry and
>>> vmexit) is available, but an IOMMU is not present. All virtual machines
>>> are configured as PVH.
>> Hmm. Then adjustments need making, for commentary and macro to be correct
>> on x86. First and foremost none of what is there is true for PV.
> 
> As is_domain_direct_mapped() returns always false for x86, so
> domain_use_host_layout macro will return incorrect value for non-hardware
> domains (dom0?). And as PV domains are not auto_translated domains so are
> always direct-mapped, so technically is_domain_direct_mapped() (or
> domain_use_host_layout()) should return true in such case.

Hmm? PV domains aren't direct-mapped. Direct-map was introduced by Arm for
some special purpose (absence of IOMMU iirc).

> (I assume it is also true for every domain except HVM according to the comment
> /* HVM guests are translated.  PV guests are not. */ in xc_dom_translated and
> the comment above definition of XENFEAT_direct_mapped: /* ...not auto_translated
> domains (x86 only) are always direct-mapped*/).
> 
> Is my understanding correct?
> 
> Then isn't that a problem of how is_domain_direct_mapped() is defined
> for x86? Shouldn't it be defined like:
>    #define is_domain_direct_mapped(d) (!paging_mode_translate(d) || ((d)->cdf & CDF_directmap))
> 
> Would it be better to move "!paging_mode_translate(d) || " to the definition
> of domain_use_host_layout()?
> 
> Could you please explain what is wrong with the comment? Probably, except:
>    * To avoid any trouble finding space, it is easier to force using the
>    * host memory layout.
> everything else should be true for x86.

"The hardware domain will use ..." isn't true for PV Dom0.

Jan


  reply	other threads:[~2026-02-18 13:12 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-12 16:21 [PATCH v1 0/6] RISCV: enable DOMAIN_BUILD_HELPERS Oleksii Kurochko
2026-02-12 16:21 ` [PATCH v1 1/6] xen/riscv: implement get_page_from_gfn() Oleksii Kurochko
2026-02-16 12:38   ` Jan Beulich
2026-02-16 12:41     ` Jan Beulich
2026-02-17  9:01     ` Oleksii Kurochko
2026-02-17  9:10       ` Jan Beulich
2026-02-17  9:58         ` Oleksii Kurochko
2026-02-17 10:40           ` Jan Beulich
2026-02-12 16:21 ` [PATCH v1 2/6] xen/riscv: implement copy_to_guest_phys() Oleksii Kurochko
2026-02-16 14:57   ` Jan Beulich
2026-02-17 10:25     ` Oleksii Kurochko
2026-02-17 10:42       ` Jan Beulich
2026-02-12 16:21 ` [PATCH v1 3/6] xen/riscv: add zImage kernel loading support Oleksii Kurochko
2026-02-16 16:31   ` Jan Beulich
2026-02-17 11:58     ` Oleksii Kurochko
2026-02-17 13:02       ` Jan Beulich
2026-02-17 15:28         ` Oleksii Kurochko
2026-02-12 16:21 ` [PATCH v1 4/6] xen: move declaration of fw_unreserved_regions() to common header Oleksii Kurochko
2026-02-12 16:21 ` [PATCH v1 5/6] xen: move domain_use_host_layout() " Oleksii Kurochko
2026-02-16 16:36   ` Jan Beulich
2026-02-16 18:42     ` Stefano Stabellini
2026-02-17  7:34       ` Jan Beulich
2026-02-18 12:58         ` Oleksii Kurochko
2026-02-18 13:12           ` Jan Beulich [this message]
2026-02-18 14:38             ` Oleksii Kurochko
2026-02-18 14:50               ` Jan Beulich
2026-02-28  1:42                 ` Stefano Stabellini
2026-02-28  1:59                   ` Stefano Stabellini
2026-02-12 16:21 ` [PATCH v1 6/6] xen/riscv: enable DOMAIN_BUILD_HELPERS Oleksii Kurochko
2026-02-12 16:39   ` Jan Beulich
2026-02-13 12:54     ` Oleksii Kurochko
2026-02-13 13:11       ` Jan Beulich
2026-02-18 10:39         ` Oleksii Kurochko
2026-02-18 10:45           ` Jan Beulich
2026-03-17 12:49         ` Oleksii Kurochko
2026-03-19  7:58           ` Jan Beulich
2026-03-20  9:58             ` Oleksii Kurochko
2026-03-20 13:19               ` Jan Beulich
2026-03-20 14:30                 ` Oleksii Kurochko

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=0c0061ab-acdb-4ceb-92e2-ca4e591ee741@suse.com \
    --to=jbeulich@suse.com \
    --cc=Romain.Caritey@microchip.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=bertrand.marquis@arm.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=oleksii.kurochko@gmail.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.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.