[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 1/4] xen/arm/static-shmem: Static-shmem should be direct-mapped for direct-mapped domains


  • To: Michal Orzel <michal.orzel@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • From: Henry Wang <xin.wang2@xxxxxxx>
  • Date: Mon, 20 May 2024 23:51:26 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eyUrQ23iDzW2/ijRs7j6gY/PKXIw77SJywLxUp/9efU=; b=Fg06qe4JB0XRKLf7W+VaZi9e2BtPvXF1Eut4Awd2J9dLlxKGb6xXGwLvLO/h96x11uAFMwzSjcSBKCZiNZzvGYVn5OC+GN2Igq6CN4ImTqqt9Dss+K4Nd2lAqSfPUMXNWgLwGDhOe042ILL8tmk4bFnc2Panpw+EHGNV4GlceF7EM8iuIOp356Te9tbJbkQHrBcyFMcIXBEZnRxtWw4MW914klF8vFWafeNgIKUvNm6UAP4G8xxXA23nkGDu8KYKsvU68Pmny/eGsXFvrLFFabhPYz7vYzQ/EAd2kFZqHioqTc73T1e9xudhfm3Z2F2bQKlDfjec88nryisJv2tcqg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IMqax1w0bLnuSwUCJfyquMm+MLFBlK+mXlytLO4AcotDdllcDP/iW6IYOkfqqyBjvT+26Fx2thsb4wP5osTcD37MUnD6a6/Gj2ZOVixAIINJSMvAwIHad6p29Yl6VkPSXGgZEjjw2LAubsnx3C2C55wn96joGm2UsoOcIP1Nb5dst0z01Y8m0rVhYY6bzr+dxSVXLzyB1h/61QPwnbTv9d0ShdoE7miM/cxuIHwnXEYPN+p6ueX7qwQ9WZ76JP2dDbtM071R4S/GHfC3hPkNmPoVAF0Vy6GdnpWJaDOff/x4kRGZISIQXx6YhEPH8PB8bt7xbZJFkci146wH/zV9KQ==
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, "Volodymyr Babchuk" <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Mon, 20 May 2024 15:51:46 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Michal,

On 5/20/2024 11:46 PM, Michal Orzel wrote:
Hi Henry,

On 20/05/2024 16:52, Henry Wang wrote:
Hi Michal, Luca,

On 5/20/2024 7:24 PM, Michal Orzel wrote:
Hi Henry,

+CC: Luca

On 17/05/2024 05:21, Henry Wang wrote:
To make things easier, add restriction that static shared memory
should also be direct-mapped for direct-mapped domains. Check the
host physical address to be matched with guest physical address when
parsing the device tree. Document this restriction in the doc.
I'm ok with this restriction.

@Luca, do you have any use case preventing us from making this restriction?

This patch clashes with Luca series so depending on which goes first,
I agree that there will be some conflicts between the two series. To
avoid back and forth, if Luca's series goes in first, would it be ok for
you if I place the same check from this patch in
handle_shared_mem_bank() like below?

diff --git a/xen/arch/arm/static-shmem.c b/xen/arch/arm/static-shmem.c
index 9c3a83042d..2d23fa4917 100644
--- a/xen/arch/arm/static-shmem.c
+++ b/xen/arch/arm/static-shmem.c
@@ -219,6 +219,13 @@ static int __init handle_shared_mem_bank(struct
domain *d, paddr_t gbase,
       pbase = shm_bank->start;
       psize = shm_bank->size;

+    if ( is_domain_direct_mapped(d) && (pbase != gbase) )
+    {
+        printk("%pd: physical address 0x%"PRIpaddr" and guest address
0x%"PRIpaddr" are not direct-mapped.\n",
+               d, pbase, gbase);
+        return -EINVAL;
+    }
+
       printk("%pd: SHMEM map from %s: mphys 0x%"PRIpaddr" -> gphys
0x%"PRIpaddr", size 0x%"PRIpaddr"\n",
              d, bank_from_heap ? "Xen heap" : "Host", pbase, gbase, psize);

Acked-by: Michal Orzel <michal.orzel@xxxxxxx>
Thanks. I will take the tag if you are ok with above diff (for the case
if this series goes in later than Luca's).
I would move this check to process_shm() right after "gbase = dt_read_paddr" 
setting.
This would be the most natural placement for such a check.

That sounds good. Thanks! IIUC we only need to add the check for the pbase != INVALID_PADDR case correct?

Kind regards,
Henry

~Michal




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.