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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 44B9DC47074 for ; Fri, 5 Jan 2024 01:50:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Message-ID:MIME-Version:References: In-Reply-To:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pPzLXoOg9NaHgKtmM3MeR73a/prjJcuLRdbrX313xXg=; b=G0jeqXSPZNQ96d 12XD57aV0/5DSUiWQcx2KkXj3/rr8yqdyA/qTJtlwmuwVfllOMDaq9QXw9BqO0uG3F/Ka/r0VgJxU ZYtSHqhGJOzc5GbdTIscy+h9r8XoHBeQYScBp2YyNbd2szRj5zU1jhM8F/NovY9jbqHkOLYijPIVU iGdY9BBubQI4UgVczBXAq7ubJitmNXUNlVE4bVIvDwbvM4EgzHp1BZkGXz8biZzzhHQ4/HI4XCD4t n9TKstR+2WS65P/uRtHFNLnCiNRL+p8Uf9lkjp4zF1fs6YalioSeRmn1ZqGpOEzdKhNk4zXp+NSpA N0VoMDbNi/IZUSCcxiYA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rLZLt-00Fk9X-1U; Fri, 05 Jan 2024 01:50:25 +0000 Received: from m15.mail.126.com ([45.254.50.224]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rLZLq-00Fk7V-26 for linux-arm-kernel@lists.infradead.org; Fri, 05 Jan 2024 01:50:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=Date:From:Subject:Content-Type:MIME-Version: Message-ID; bh=wfVLH9EXLUs4ww7MRcLprkmIe6LmhdvkBR/pT6c+dYs=; b=Z 0k/4k+4PJRA5rZiw7WifAYZB23BUf78NMXKwuS2vLXdcDpjhgZ7DLXj13XTRbho7 hfS+NDIpOBy8ZKzgYvZpJmN7uJ6mbj+yPNUYUFFPfIyS4+byXvhz94VctHtpjUc4 6h7qnZRFivNTbOY7cI6C92NCk6L7l/T/ZqFmURk/vU= Received: from figure1802$126.com ( [116.230.163.157] ) by ajax-webmail-wmsvr-41-110 (Coremail) ; Fri, 5 Jan 2024 09:50:09 +0800 (CST) X-Originating-IP: [116.230.163.157] Date: Fri, 5 Jan 2024 09:50:09 +0800 (CST) From: Ben To: "Nicolin Chen" Cc: eric.auger@redhat.com, linux-arm-kernel Subject: Re:Re: Re: Re: Re: how test the Translation Support for SMMUv3? X-Priority: 3 X-Mailer: Coremail Webmail Server Version XT5.0.14 build 20230109(dcb5de15) Copyright (c) 2002-2024 www.mailtech.cn 126com In-Reply-To: References: <61332e87.404e.18caa3d6e15.Coremail.figure1802@126.com> <141aeebe.1299.18cc03d503d.Coremail.figure1802@126.com> <4bb04c20.66ed.18ccfa87b41.Coremail.figure1802@126.com> <2fa4ae48.65c6.18cd49ba689.Coremail.figure1802@126.com> X-NTES-SC: AL_Qu2bBviatkwr7yeeZOkfm0oWj+08XcOxuPgn3oFQNpp+jDHjxCU5RVVpFlrf8+22MzisszK9cAVl1dlmQJJDfa0AxVZ46pIRmNApv/S5l95fCw== MIME-Version: 1.0 Message-ID: <6cea5148.f93.18cd7503f65.Coremail.figure1802@126.com> X-Coremail-Locale: zh_CN X-CM-TRANSID: _____wD3fxNSYJdliBkJAA--.57165W X-CM-SenderInfo: pilj32bhryija6rslhhfrp/1tbi2xFbXmVLYlO5nwAFsz X-Coremail-Antispam: 1U5529EdanIXcx71UUUUU7vcSsGvfC2KfnxnUU== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240104_175023_068094_EA911784 X-CRM114-Status: GOOD ( 11.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org At 2024-01-05 06:35:12, "Nicolin Chen" wrote: >On Thu, Jan 04, 2024 at 09:13:39PM +0800, Ben wrote: >> At 2024-01-04 01:38:11, "Nicolin Chen" wrote: >> >The "Unassigned class" returned by the lspci running in the >> >host is likely telling you that your kernel doesn't support >> >the device at all? >> >> The device (13b5 ff80) is a special device (SMMUv3TestEngine) implemented in FVP, >> I wrote a simple PCI driver for it, just probe and call dma_alloc_coherent() API to alloc a DMA buffer. >> >> Here is log on Guest side: >> / # insmod smmu_test.ko >> [ 8251.668308] smmu_test: module verification failed: signature and/or required key missing - tainting kernel >> [ 8251.671198] smmu_test 0000:00:02.0: Adding to iommu group 1 >> [ 8251.672748] arm_smmu_attach_dev======== >> [ 8251.673823] arm_smmu_domain_finalise_s1 ==== >> [17991.095955] arm-smmu-v3 arm-smmu-v3.0.auto: arm_smmu_domain_finalise_nested ====== >> [ 8251.675278] smmu_test 0000:00:02.0: enabling device (0000 -> 0002) >> qemu-system-aarch64-iommufd: IOMMU_IOAS_MAP failed: Bad address >> qemu-system-aarch64-iommufd: vfio_container_dma_map(0xaaaaf4b56c60, 0x8000000000, 0x40000, 0xffffbc6a4000) = -14 (Bad address) >> qemu-system-aarch64-iommufd: IOMMU_IOAS_MAP failed: Bad address >> qemu-system-aarch64-iommufd: vfio_container_dma_map(0xaaaaf4b56c60, 0x800004c000, 0x1000, 0xffffbf49d000) = -14 (Bad address) >> [ 8251.678163] smmu_test_pci_probe === reg_phy 0x8000000000, len 0x40000 >> [ 8251.679978] smmu_test_pci_probe === reg 0xffff800009300000 >> [ 8251.681908] smmu_test_alloc_dma ---- iova 0xffff800008008000 dma_addr 0xfffff000 > >Given the dma_addr looks good to me, I think the result is a "pass"? do you think this dma_addr is GPA or SPA? I think it looks pass. > >> so in this log, some qemu error logs are observed, does it the nested SMMU work fine? > >0x8000000000 stuff are the PCI bar memory space that isn't supported >well yet, why said this PCI bar memory space isn't supportedit well, hardware issue or software issue? this is physical address of the PCI bar 0, it got from below code: iommu->reg_phys = pci_resource_start(pdev, 0); >which shouldn't break a DMA test with 2-stage translation. > >> In the Guest side, is it GPA or SPA about the return address (dma_addr) of dma_alloc_coherent() API? > >I think so. Try the same test in the host and see if it returns a >similar print, just ignoring those QEMU logs. Here is the log for Host side: [ 0.720409] smmu_test 0000:02:00.0: Adding to iommu group 1 [ 0.720427] smmu_test 0000:02:00.0: enabling device (0000 -> 0002) [ 0.720433] smmu_test_pci_probe === reg_phy 0x70100000, len 0x40000 [ 0.720439] smmu_test_pci_probe === reg 0xffff800009f80000 [ 0.720447] smmu_test_alloc_dma ---- iova 0xffff800009669000 dma_addr 0xfffff000 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel