From nobody Sat Oct 4 23:47:51 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1759220530; cv=none; d=zohomail.com; s=zohoarc; b=aamKeoktHSmlQwdxMwmDjheqONesrfRTKfUYDXhHBLUBZTFsNk1LYc3jdM9OUNfvFtSZEYeZHjlcOiZYxNDjrjEXXa3uTF5Bzt8B8MRBcw/zvkmVy8XHa3Oq4w/bErxoZQRfzF837fY7CnXNbgnWmlmQRipYn3ZbddavVaOmUzA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1759220530; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=g6Y+9YynyQUWZr+3xZXfGIWc6Jhbj4AT6sZ58oDn40Q=; b=EtaA9IAKoQD2GpN/3CBAFS4Bo2kZ35jjON66jTbBKi7MbCNgAj471Z2zP0H5Vu6ZFz3wI+1g/oZPN159QzUrYaykG/G3MLKpN0ki+Q/fktJI/LkcV/Pd/X5fAIBFRM0MW4c57rpPHhI2G409FRENd6V4HlGmF0kzg7pVzD8Vey4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1759220530820874.102759759386; Tue, 30 Sep 2025 01:22:10 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1133830.1471889 (Exim 4.92) (envelope-from ) id 1v3VcE-0007aq-7D; Tue, 30 Sep 2025 08:21:42 +0000 Received: by outflank-mailman (output) from mailman id 1133830.1471889; Tue, 30 Sep 2025 08:21:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1v3VcE-0007ZJ-26; Tue, 30 Sep 2025 08:21:42 +0000 Received: by outflank-mailman (input) for mailman id 1133830; Tue, 30 Sep 2025 08:21:41 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1v3VcD-0007Nn-1f for xen-devel@lists.xenproject.org; Tue, 30 Sep 2025 08:21:41 +0000 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [2a00:1450:4864:20::442]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 7da6eb91-9dd6-11f0-9d14-b5c5bf9af7f9; Tue, 30 Sep 2025 10:21:40 +0200 (CEST) Received: by mail-wr1-x442.google.com with SMTP id ffacd0b85a97d-3f44000626bso3412264f8f.3 for ; Tue, 30 Sep 2025 01:21:40 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-40fb72fb1a3sm22070432f8f.10.2025.09.30.01.21.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 30 Sep 2025 01:21:39 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 7da6eb91-9dd6-11f0-9d14-b5c5bf9af7f9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1759220500; x=1759825300; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=g6Y+9YynyQUWZr+3xZXfGIWc6Jhbj4AT6sZ58oDn40Q=; b=Y+cM7YYeLTxfQkqKS2tGafYM6ACeJL+5PwfoYXtJvCjlfoIMGKEdpb3xw4rI9JfvwV TZhmcVCz0WZmFjmEs6HN31nEu60M9XrIFy7R4qiKpbfqfXU6abVQY7iqw5OnqqyKq/21 NiHL1x4v3rJEgbgJd1ErF0lOtTnq/3teCHJzgc23ZQUeo+ScJr8gSMUS35bfoL66L7Lx zlGU6s98FZtAAqNteP+H9LMFUDnSUGSDcrd7AARTQNqgce3V3VoLI3+zgrK+h2/kpQ7M /fmkR0OztvcIaMrEEqLNKg4XC1oj/2TXNgrq8CvAovUp/6gyrJZY2TkqEBi9aRajO+7I UR5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759220500; x=1759825300; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=g6Y+9YynyQUWZr+3xZXfGIWc6Jhbj4AT6sZ58oDn40Q=; b=cfdZ5eSGtrsGd3C6KuPMN6YFp8vGDVYqlPMFCsURDrG02rT4AaYNEfeWkoiUvGi8WG vlt0PNlFwvWIf5S6Ls5/sBe6mi1K6FUPtRYfKB9SDNBKIbISo4DwT58VUaWDnjhj7JKY PYlgO5meUqUPp5F9UGm3L+kqlvcozkyec5GKReWQSWlIuPykUpJBHZ2PrDHqK6zBqPzo 5ElwLLzFsA0wt+YiBbktKPYgIW8aorMBKZage8h6omyZXFy8/lR6clSMdQe34B3/odnX CXA6VoxKO24Ph/7LJV8eIg7lQRjaw2ta9taLarTHm90fNmFgeyyHFcBTBMoAXjIaWe4Y XBiQ== X-Forwarded-Encrypted: i=1; AJvYcCVGW2YeVGD+EV41LobJFQbX62997gaC619aPkNjtg2ESNoHZxGtD8/xNZ2PsD+eaXg5IGaP8+hwlUM=@lists.xenproject.org X-Gm-Message-State: AOJu0YzI8J7Y6SIWs0lZH/PLsEs7ZUqgyyfk/99OS6Ud8fChSeneB4aA e5JucdrWkjKDINdy5k0jg1SXhVGK1z6Ekw9ET6BEgEfjkiivBekCNwq1WbjloHdqEMo= X-Gm-Gg: ASbGncu+8Jqs9p41sZnKrwd2S2o12XvXk7a3bOGka0fUorY/aLnIaJ9kuwq5DPQvTog b5AQToqbKnw37nRYvO1bAc/mqdaKeYbZnp8cDCXpJ2Zswa/LbU93PIBWNWZfN3L3rjM8Qxa9EsG DIwhrjElIvFMjtyxQ5DkSVy3WJNI14Q5j8WNotllAnvfxg2wxqTG1p9jofruu6TOvtsvBzsI9IV cxlSk9ClOq3BqpEzGMGrmBMkx58HfMSLRIn7RPxyEbGqRTU5zI5/7cnLYWvKvQzBjWgSNXQb3j8 0iv0ZiXnKF+jIHeNmjrk2PqrzXSNn162utoIsqSZPrOOo59DEIUFunxZt8l2lVsWXYAiZ4gsgKZ cj9mO2Z0pq7xKO4/INKG3dugO70+LloQBUetLYzdbM8KBLqZY8pQAfhK2pKaMIkBex6tWFyLrNI yisFY7a+jr7we7jlRAqkxX X-Google-Smtp-Source: AGHT+IEvqZbVxTkOzuE7/OdSy85DpVZk0C8frEdFACso26c6+h9s7puUVSPKjShsswhtViU8Ba02iA== X-Received: by 2002:a05:6000:18a7:b0:3e9:d0a5:e436 with SMTP id ffacd0b85a97d-40e437371acmr19688375f8f.23.1759220499859; Tue, 30 Sep 2025 01:21:39 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Peter Maydell Cc: Marcelo Tosatti , Ilya Leoshkevich , Reinoud Zandijk , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Zhao Liu , David Hildenbrand , Halil Pasic , kvm@vger.kernel.org, "Edgar E. Iglesias" , xen-devel@lists.xenproject.org, Stefano Garzarella , David Woodhouse , Sunil Muthuswamy , Richard Henderson , Stefano Stabellini , Matthew Rosato , qemu-s390x@nongnu.org, Paul Durrant , "Michael S. Tsirkin" , Christian Borntraeger , Anthony PERARD , Jason Herne , Paolo Bonzini , Thomas Huth , Eric Farman Subject: [PATCH v3 02/18] system/memory: Better describe @plen argument of flatview_translate() Date: Tue, 30 Sep 2025 10:21:09 +0200 Message-ID: <20250930082126.28618-3-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250930082126.28618-1-philmd@linaro.org> References: <20250930082126.28618-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1759220532331116600 flatview_translate()'s @plen argument is output-only and can be NULL. When Xen is enabled, only update @plen_out when non-NULL. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth --- include/system/memory.h | 5 +++-- system/physmem.c | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/system/memory.h b/include/system/memory.h index aa85fc27a10..3e5bf3ef05e 100644 --- a/include/system/memory.h +++ b/include/system/memory.h @@ -2992,13 +2992,14 @@ IOMMUTLBEntry address_space_get_iotlb_entry(Address= Space *as, hwaddr addr, * @addr: address within that address space * @xlat: pointer to address within the returned memory region section's * #MemoryRegion. - * @len: pointer to length + * @plen_out: pointer to valid read/write length of the translated address. + * It can be @NULL when we don't care about it. * @is_write: indicates the transfer direction * @attrs: memory attributes */ MemoryRegion *flatview_translate(FlatView *fv, hwaddr addr, hwaddr *xlat, - hwaddr *len, bool is_write, + hwaddr *plen_out, bool is_write, MemTxAttrs attrs); =20 static inline MemoryRegion *address_space_translate(AddressSpace *as, diff --git a/system/physmem.c b/system/physmem.c index 8a8be3a80e2..86422f294e2 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -566,7 +566,7 @@ iotlb_fail: =20 /* Called from RCU critical section */ MemoryRegion *flatview_translate(FlatView *fv, hwaddr addr, hwaddr *xlat, - hwaddr *plen, bool is_write, + hwaddr *plen_out, bool is_write, MemTxAttrs attrs) { MemoryRegion *mr; @@ -574,13 +574,14 @@ MemoryRegion *flatview_translate(FlatView *fv, hwaddr= addr, hwaddr *xlat, AddressSpace *as =3D NULL; =20 /* This can be MMIO, so setup MMIO bit. */ - section =3D flatview_do_translate(fv, addr, xlat, plen, NULL, + section =3D flatview_do_translate(fv, addr, xlat, plen_out, NULL, is_write, true, &as, attrs); mr =3D section.mr; =20 - if (xen_enabled() && memory_access_is_direct(mr, is_write, attrs)) { + if (xen_enabled() && plen_out && memory_access_is_direct(mr, is_write, + attrs)) { hwaddr page =3D ((addr & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE) - a= ddr; - *plen =3D MIN(page, *plen); + *plen_out =3D MIN(page, *plen_out); } =20 return mr; --=20 2.51.0