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 25E41C83F2D for ; Thu, 29 Aug 2024 16:11:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:CC:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=V0X5zeTS2WqgWuWC59E408gKpa+ayQeMHnHNvZ7OVn4=; b=meWlKuNNxpiY/oqgrAH05sYUjY jWakzQhxiqLoiTU9TcvJzYwHM0gyVbQCyyHensITimiWxvQIIfzUgdQMAs6in2Ty3981exn0NtgiI j/bI+ZLF549gZHbde64kus+eMfXAaoeNOCmkMhOIEyY9YlodH12Yth8E7Q9EHG1ISW0QRJhyJVMsy ViYYNWmdUvxjP1p15x4rDmVmyyOoU4NS0ye4F1+v6gNJWccNL7SyHLwbxyhRnUeGUYUDNNidVuiaj gvzrxZpf6hyZu80B8P5KOIenXDEvfqT9h/j9qdFxk0QN+wRoMMiurs4kKtnT+uyNZ+uf3Ry0gliym UlRmzLqQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjhkB-00000002lhH-1vMW; Thu, 29 Aug 2024 16:11:31 +0000 Received: from mail-mw2nam10on20609.outbound.protection.outlook.com ([2a01:111:f403:2412::609] helo=NAM10-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjhjK-00000002lSR-1nmv for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 16:10:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=h5WaexmTKJeZZ0iaCtaPaQs5z9b6elC7Vfgex3USH/JaflDNDS256hhFmYcRpDaX9OL4KcuOzcUxh5qDhtruWbprXElqh6e/xhzi7UWtd/QvYOV2TgJc3q5651G9wWB4MOfjbHxU0DOk4iNpS2qYt7JDHx3a33GnMCMZFrGl89MM+OwxR6gyhGDqfcdboeoVG97aGziGJtU04yhcQeXYaL/KohwKKaAJAIBY9eoxDOEhlDNA/FMhtBUl9sRsunvHeCom2pAqg0Av3knnDRqB9D77CcNITUtNe3ekzFap/tfworiUgvnpoqmcCEoQuhAjkYEDqDKXgsfvqBxKUa1R6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=V0X5zeTS2WqgWuWC59E408gKpa+ayQeMHnHNvZ7OVn4=; b=XQ1um/DttWnXU48/GzY2q8V959xQVuQPxyFbxUOGa8kTyib/hJcZhL7SptSe5kT3pWWYeSRHndg50o9lZz716VVCck+crDpOqDuKVbdo70RXuw2ADi1NCRWQHmp9h6JkgonL3f/fxkvY5ZUhE/g57pvjEnUt1oMvCcVIoGeZICnyH6ro+71Yu2uYGpwUKmZmJpGpuBQ9zhmeGDS+Z/IfuhL82+4Ybnn4/McIOJWsbP/M6+w15ujIW+nkGusXIgH0RV+Ofmskc6M2QNSedvVEVzj11E9/D7o1fLCsoITHkjmUQr/F4LXSKrHEZDSh0SB5cQ8b2UBX7NoHBZbeafkvrQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=huawei.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=V0X5zeTS2WqgWuWC59E408gKpa+ayQeMHnHNvZ7OVn4=; b=QzME5MphKWbnRPmnjEQUjOHiLSmqZ/KRe59NCxiDxmc5lS/QVf0BxK4+LE5biYiFZwhWZaWlTA8D0LRFws1LQbXRjDc7SyAesI/D36m8xgGehtbC2Ynx5Pljrq2zmj9enEbABroqKXvcehpmq4TTD5KgOG3pLGiXb0EAH1DPM6hw24mcNU7xYZKpqcifPT7Yn++uyDnXqrEnA3H+MzqdT3nB0xfiqo7OchaxwgVTDYQNlpjmHa3FbXV383hcAhRW62aedW1tajdwKYfNAubG+EGDxh2nhUKP44LEzL/kWFB0JQAZOHzK9tp7CSSagr8x2+vb4GRD3zY+TGnhCBvwDw== Received: from SJ0PR13CA0019.namprd13.prod.outlook.com (2603:10b6:a03:2c0::24) by BL3PR12MB6643.namprd12.prod.outlook.com (2603:10b6:208:38f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.28; Thu, 29 Aug 2024 16:10:26 +0000 Received: from SJ1PEPF000023D1.namprd02.prod.outlook.com (2603:10b6:a03:2c0:cafe::4d) by SJ0PR13CA0019.outlook.office365.com (2603:10b6:a03:2c0::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.19 via Frontend Transport; Thu, 29 Aug 2024 16:10:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SJ1PEPF000023D1.mail.protection.outlook.com (10.167.244.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.13 via Frontend Transport; Thu, 29 Aug 2024 16:10:24 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 29 Aug 2024 09:10:09 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 29 Aug 2024 09:10:09 -0700 Received: from Asurada-Nvidia (10.127.8.13) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4 via Frontend Transport; Thu, 29 Aug 2024 09:10:07 -0700 Date: Thu, 29 Aug 2024 09:10:06 -0700 From: Nicolin Chen To: Shameerali Kolothum Thodi CC: Jason Gunthorpe , "acpica-devel@lists.linux.dev" , "Guohanjun (Hanjun Guo)" , "iommu@lists.linux.dev" , Joerg Roedel , Kevin Tian , "kvm@vger.kernel.org" , Len Brown , "linux-acpi@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Lorenzo Pieralisi , "Rafael J. Wysocki" , "Robert Moore" , Robin Murphy , "Sudeep Holla" , Will Deacon , Alex Williamson , Eric Auger , Jean-Philippe Brucker , Moritz Fischer , Michael Shavit , "patches@lists.linux.dev" , Mostafa Saleh Subject: Re: [PATCH v2 0/8] Initial support for SMMUv3 nested translation Message-ID: References: <0-v2-621370057090+91fec-smmuv3_nesting_jgg@nvidia.com> <7debe8f99afa4e33aa1872be0d4a63e1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023D1:EE_|BL3PR12MB6643:EE_ X-MS-Office365-Filtering-Correlation-Id: 119f52ce-18e8-4ce2-5a94-08dcc8451764 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|376014|7416014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ix7TIYIKlmpv/ZoQ+QVzrCai0bsrthbkzYvbLZqqhfYI0zuKh1MmEYwYJom6?= =?us-ascii?Q?+PDz3r6lBLHrjI81F1JycfyaxWyT2bcQaAvGe7A+KWOXF7PRtWsrzEdjX7B8?= =?us-ascii?Q?4aSM3r/gyPwb2kcoK1iGsrqd8LY3lP92g5Z5lSwwcTvd6KKLKugAJzkp5zsT?= =?us-ascii?Q?TtJHaC0DoDvrwNnf07ZUmkS+LJeEw2lWvFV178r/0wB9g/+f+GKJhK2veCWl?= =?us-ascii?Q?rBE8nclxzHri4EQhWUI1ZksHVCWEn5L/Qbgpx03Va50OW+1vDr4wIsseAm9A?= =?us-ascii?Q?AoOyFqY9N1r/tK/VK+YFZ4Nua2GjUrhvfjmaLFF/XmQ9JcmXg/TMLxnMEnlW?= =?us-ascii?Q?vRyeGSuYz0QU0gcBf5W0K+0FrMbUKE0MM43wVW5DE/Ej4aKgGWP/CNNyNNAA?= =?us-ascii?Q?I6b1i1qRKACDv2krRKejWjPVQqkhKdZYGDDyiX3hYPPCR4HQXVTVP+A60nEB?= =?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iSlAl8gCe4Vo7Lv3N?= =?us-ascii?Q?8jdrtdM5D5kmwAvfK++ZkhdqG8WUKryXHa19oPvKnNmTWTV8iSu1I47SsYKN?= =?us-ascii?Q?iKcOGND4k90etOpDTqgDHL/v9ca80/VD?= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(36860700013)(1800799024)(376014)(7416014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2024 16:10:24.9269 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 119f52ce-18e8-4ce2-5a94-08dcc8451764 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF000023D1.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6643 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240829_091038_851399_3858C228 X-CRM114-Status: GOOD ( 14.89 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Aug 29, 2024 at 02:52:23PM +0000, Shameerali Kolothum Thodi wrote: > > That makes some progress. But still I am not seeing the assigned dev in > > Guest. > > > > -device vfio-pci-nohotplug,host=0000:75:00.1,iommufd=iommufd0 > > > > root@ubuntu:/# lspci -tv# > > > > root@ubuntu:/# lspci -tv > > -+-[0000:ca]---00.0-[cb]-- > > \-[0000:00]-+-00.0 Red Hat, Inc. QEMU PCIe Host bridge > > +-01.0 Red Hat, Inc Virtio network device > > +-02.0 Red Hat, Inc. QEMU PCIe Expander bridge > > +-03.0 Red Hat, Inc. QEMU PCIe Expander bridge > > +-04.0 Red Hat, Inc. QEMU PCIe Expander bridge > > +-05.0 Red Hat, Inc. QEMU PCIe Expander bridge > > +-06.0 Red Hat, Inc. QEMU PCIe Expander bridge > > +-07.0 Red Hat, Inc. QEMU PCIe Expander bridge > > +-08.0 Red Hat, Inc. QEMU PCIe Expander bridge > > \-09.0 Red Hat, Inc. QEMU PCIe Expander bridge Hmm, the tree looks correct.. > > The new root port is created, but no device attached. > It looks like Guest finds the config invalid: > > [ 0.283618] PCI host bridge to bus 0000:ca > [ 0.284064] ACPI BIOS Error (bug): \_SB.PCF7.PCEE.PCE5.PCDC.PCD3.PCCA._DSM: Excess arguments - ASL declared 5, ACPI requires 4 (20240322/nsarguments-162) Looks like the DSM change wasn't clean. Yet, this might not be the root cause, as mine could boot with it. Here is mine (I added a print to that conflict part, for success): [ 0.340733] ACPI BIOS Error (bug): \_SB.PCF7.PCEE.PCE5.PCDC._DSM: Excess arguments - ASL declared 5, ACPI requires 4 (20230628/nsarguments-162) [ 0.341776] pci 0000:dc:00.0: [1b36:000c] type 01 class 0x060400 PCIe Root Port [ 0.344895] pci 0000:dc:00.0: BAR 0 [mem 0x10400000-0x10400fff] [ 0.347935] pci 0000:dc:00.0: PCI bridge to [bus dd] [ 0.348410] pci 0000:dc:00.0: bridge window [mem 0x10200000-0x103fffff] [ 0.349483] pci 0000:dc:00.0: bridge window [mem 0x42000000000-0x44080ffffff 64bit pref] [ 0.351459] pci_bus 0000:dd: busn_res: insert [bus dd] under [bus dc-dd] In my case: [root bus (00)] <---[pxb (dc)] <--- [root-port (dd)] <--- dev In your case: [root bus (00)] <---[pxb (ca)] <--- [root-port (cb)] <--- dev > [ 0.285533] pci_bus 0000:ca: root bus resource [bus ca] > [ 0.286214] pci 0000:ca:00.0: [1b36:000c] type 01 class 0x060400 PCIe Root Port > [ 0.287717] pci 0000:ca:00.0: BAR 0 [mem 0x00000000-0x00000fff] > [ 0.288431] pci 0000:ca:00.0: PCI bridge to [bus 00] This starts to diff. Somehow the link is reversed? It should be: [ 0.288431] pci 0000:ca:00.0: PCI bridge to [bus cb] > [ 0.290649] pci 0000:ca:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring > [ 0.292476] pci_bus 0000:cb: busn_res: can not insert [bus cb-ca] under [bus ca] (conflicts with (null) [bus ca]) > [ 0.293597] pci_bus 0000:cb: busn_res: [bus cb-ca] end is updated to cb > [ 0.294300] pci_bus 0000:cb: busn_res: can not insert [bus cb] under [bus ca] (conflicts with (null) [bus ca]) And then everything went south... Would you please try adding some prints? ---------------------------------------------------------------------- @@ -1556,6 +1556,7 @@ static char *create_new_pcie_port(VirtNestedSmmu *nested_smmu, Error **errp) uint32_t bus_nr = pci_bus_num(nested_smmu->pci_bus); DeviceState *dev; char *name_port; + bool ret; /* Create a root port */ dev = qdev_new("pcie-root-port"); @@ -1571,7 +1572,9 @@ static char *create_new_pcie_port(VirtNestedSmmu *nested_smmu, Error **errp) qdev_prop_set_uint32(dev, "chassis", chassis_nr); qdev_prop_set_uint32(dev, "slot", port_nr); qdev_prop_set_uint64(dev, "io-reserve", 0); - qdev_realize_and_unref(dev, BUS(nested_smmu->pci_bus), &error_fatal); + ret = qdev_realize_and_unref(dev, BUS(nested_smmu->pci_bus), &error_fatal); + fprintf(stderr, "ret=%d, pcie-root-port ID: %s, added to pxb_bus num: %x, chassis: %d\n", + ret, name_port, pci_bus_num(nested_smmu->pci_bus), chassis_nr); return name_port; } ---------------------------------------------------------------------- We should make sure that the 'bus_nr' and 'bus' are set correctly and all the realize() returned true?: Thanks Nicolin