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

Re: Fwd: changing Dom0 data during smc call inside of xen during cache coloring


  • To: Stefano Stabellini <stefano.stabellini@xxxxxxx>, Oleg Nikitenko <oleshiiwood@xxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Tue, 3 Oct 2023 09:33:19 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gmail.com 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
  • 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=tMsU4w1WrpCjhRirRNlQekyGIQf9iPTA7g1Tze/la7M=; b=EFwCFnEp2SBL7Zzq1M7qhW4P+HabMyNm6EOitb/n/2DUR+RXQl81fNEFtW0scR/JxYPZETwAnBUORNirWx+7qcJ6kl0oiBDhguJOEn76lveHI4LkPAO4P4xaEmi7KN5cjvS22xoxwovdiP4t/t8SlAZX6ox1kop1z4U+lVpVAJhZ2R4+k7eqqnKMswcJjjgI158XF3/d3QCY6ya9XJPPwI/UcK5XpfMDb5mKmVNfq9LJbDSGD22okopmBRAwvBZx0Ser5aGn/UD3DuoArZZZCR5tpaEdvmJIP1gkjIO9kBG77vUP3D8m3oCSLEx+hP/aodNfYhm1vdClqP6lZyH3Uw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YInhx24jq+Gt0Y3TvDTu691qGjqOhtlhf9HEw9WRae5iUM5Gaxm0MlAT6gSlxtBqywZ549JnertYlbxk9bgf1lwKBAE0assjSPOhDU21kwIJLr7wNIwhnPXlk/L1yp97ElJzbLG41auLk7wXWR+HPzPq5JEckkel29PhLdOCQLyoor5m0Lx8E6G5TcMfB8DnRZ/xAklZk9tLAS3MvbMm0yUUXJxMFkK2+s/rmOYWIGateYidjYPK7k/pLWMpDYwbrrGzgRzWVmI9tLQ55qwAEpO/2YjKuIi9sq5nae3fe0UwjhO9Mv35ihgHiGjlwFAkdZ9PVarIoWqOP3B41rhaGw==
  • Cc: Julien Grall <julien@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Carlo Nonato" <carlo.nonato@xxxxxxxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, <Stewart.Hildebrand@xxxxxxx>
  • Delivery-date: Tue, 03 Oct 2023 07:33:37 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 03/10/2023 09:28, Michal Orzel wrote:
> 
> 
> Hi Oleg, Stefano
> 
> On 03/10/2023 02:13, Stefano Stabellini wrote:
>> Hi Oleg,
>>
>> You are getting this output:
>>
>>> (XEN) d0v0 Forwarding AES operation: 3254779951 136bb00000000000 -> 
>>> fffffffffffff000
>>
>> Which means that the guest physical address is 0x136bb00000000000 and
>> the translated physical address is 0xfffffffffffff000. It generates an
>> error so you are asking if 0xfffffffffffff000 is incorrect because the
>> translation is incorrect.
>>
>> This is possible. However, I think it is more likely that
>> 0x136bb000_00000000 is incorrect. This an extremely high address. Could
>> it be wrong?
> 
> I think the issue is due to a different way of forming the r1 register for 
> this particular EEMI call:
> 
> Take a look at the PM AES function from Linux:
> https://github.com/Xilinx/linux-xlnx/blob/master/drivers/firmware/xilinx/zynqmp.c#L1975
> and EEMI call invocation:
> https://github.com/Xilinx/linux-xlnx/blob/master/drivers/firmware/xilinx/zynqmp.c#L390
> 
> The register passed as r1 is formed a bit differently than "normally". FWICS:
>  - the upper 32 bits of address are stored in the lower 32 bits of r1 
> register.
>  - the lower 32 bits of address are stored in the upper 32 bits of r1 
> register.
> 
> That is why you are getting a very high address in r1 0x136bb000_00000000.
> 
> Please, try to do the following (not tested):
> 
> case 0xC200002F:
> {
>     register_t gaddr, new_gaddr;
>     paddr_t maddr;
> 
>     gaddr = ((register_t)get_user_reg(regs, 1) << 32) | (get_user_reg(regs, 
> 1) >> 32);
>     maddr = mfn_to_maddr(gfn_to_mfn(current->domain, gaddr_to_gfn(gaddr)));
> 
>     /* Most probably not needed given dma_alloc_coherent use */
>     maddr += gaddr &~ PAGE_MASK;
> 
>     /* Convert back to required format */
>     new_gaddr = ((register_t)maddr << 32) | (maddr >> 32);
> 
>     arm_smccc_1_1_smc(get_user_reg(regs, 0),
>             get_user_reg(regs, 1),
>             new_gaddr,
Wrong placement. This should be for register 1 and not 2, so:
    arm_smccc_1_1_smc(get_user_reg(regs, 0),
            new_gaddr,
            get_user_reg(regs, 2),
            get_user_reg(regs, 3),
            get_user_reg(regs, 4),
            get_user_reg(regs, 5),
            get_user_reg(regs, 6),
            get_user_reg(regs, 7),
            &res);

~Michal



 


Rackspace

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