From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 250CAE9A047 for ; Wed, 18 Feb 2026 13:12:28 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1235551.1538510 (Exim 4.92) (envelope-from ) id 1vshLh-0001aD-Hz; Wed, 18 Feb 2026 13:12:13 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1235551.1538510; Wed, 18 Feb 2026 13:12:13 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vshLh-0001a6-F3; Wed, 18 Feb 2026 13:12:13 +0000 Received: by outflank-mailman (input) for mailman id 1235551; Wed, 18 Feb 2026 13:12:12 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vshLg-0001a0-DM for xen-devel@lists.xenproject.org; Wed, 18 Feb 2026 13:12:12 +0000 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [2a00:1450:4864:20::434]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 6cd62f2e-0ccb-11f1-9ccf-f158ae23cfc8; Wed, 18 Feb 2026 14:12:07 +0100 (CET) Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-43945763558so2340625f8f.3 for ; Wed, 18 Feb 2026 05:12:07 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43796a6c1b4sm39635235f8f.14.2026.02.18.05.12.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Feb 2026 05:12:05 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 6cd62f2e-0ccb-11f1-9ccf-f158ae23cfc8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1771420326; x=1772025126; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=jgOU8DpEqvFl+9GpN4Jie7xcZawNhYLJFYr9No6Vk7c=; b=KRzpr0SwDubN48f118TrsXlOhGDGHGl03TjLgfkVYl+5T9gQEWfZ+t48bVcG12Ysmc 375lEq2RIiwCKUpmYmb/K7ieqWCuTy1OJp3n2Bu/f+aKEwTbK1eL1DDe/6y5CFwWCuN9 jK2PGRNQeWCQmEpkqn4fauaUumApIEiZw24RkGqbzs+tam1aMaDITRQPcAWfg/XP286H PGri/eklJfc2JITJm7LpsqaMIwVKYWE9ov97AZ4+HhmI7aqS1RbXyfcm2jVyb9Wrah7M C1S0Ne7tQ4EnCmQuvntNlHTrjBLf2BkvXmn6vgoJnL2eGUPmXzQmOgj7gRedvY1s5O8c MVug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771420326; x=1772025126; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=jgOU8DpEqvFl+9GpN4Jie7xcZawNhYLJFYr9No6Vk7c=; b=lSia6XyukDiOBGKidhPY8DLjrFGlCewaPPGSYgN35mknGkatc6MdR/rOU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OzYdawHcgRjZtqv v7C8OziAL2qq9I= X-Received: by 2002:a05:6000:1a8c:b0:435:8f1b:bb32 with SMTP id ffacd0b85a97d-43796aefc5cmr34904823f8f.32.1771420326357; Wed, 18 Feb 2026 05:12:06 -0800 (PST) Message-ID: <0c0061ab-acdb-4ceb-92e2-ca4e591ee741@suse.com> Date: Wed, 18 Feb 2026 14:12:04 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 5/6] xen: move domain_use_host_layout() to common header To: Oleksii Kurochko Cc: Romain Caritey , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Andrew Cooper , Anthony PERARD , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= , xen-devel@lists.xenproject.org, Stefano Stabellini References: <678eb53c56bc4f6147feb0bbb6c1319197d0f0df.1770821989.git.oleksii.kurochko@gmail.com> <522a71ce-05da-4a66-956e-5581f0c49e0e@suse.com> <5eb4ba3b-f7b6-4cfb-ab67-60198c3f8572@gmail.com> Content-Language: en-US From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJOb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-To: <5eb4ba3b-f7b6-4cfb-ab67-60198c3f8572@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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