Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1244286ybp; Fri, 4 Oct 2019 11:36:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqx7O/ph6Fdkppd1ZROQPcC/BSi97BfPbcjrVltuq7xPrXpOWDlXAVBF0umBmvFWkHPdQzpV X-Received: by 2002:a17:906:8041:: with SMTP id x1mr13772088ejw.132.1570214176676; Fri, 04 Oct 2019 11:36:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570214176; cv=none; d=google.com; s=arc-20160816; b=D9gn65oUuB6B0v+YPCfaSuhsibJutZhVxczfhPTdhBwnbQgeoxUrAQ2THZWz31Py/k tOa324Wi+/9xuQrRU6hftujz3MmPkZRI1OJGO7qBlTu7w3MFTbvH2lcV4RbRRLUkS9GS doGB4gXXhqFu7eJBSaojtCGXPIUJSx8KG50jpLQwzLDwKElvIfAKwJWEnQivUApeB2TI 5AnFmJLy0rEZVqy/niw8xylPgTDyFh3pEkkGB1fooG9RDm1GyVW96kiHWx8jTvL8yXsG ty4BcXQzzo3xShXdcZXvE6sLsO2f9QDIdoKkBz6L8BoNVcNl13aRN47WA9oI2Y5+KKBi fvIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=L+7833WtdIy1TRp8weHGMEExppYfpNqR9z7n1Y4p08o=; b=TwLhXkZiq1NCPTntTHgsgwspJbt924a0sSCJiWjWrzSAqgxCMfKASLAp/mz4smz3Gj 1q60+eGabo4rU8dF1Azxpm5yCngMToyc6M1VxtnlCS7j7vfSsL0bWqjjwswPxUjzmvzN /CHZt28hwXthiu8pKy5wDjlidcMQZ06vg1Hl53o1pCTPgExkS3b4Surgi5mP9SBjklPt LZVJ+HP0ZKBTTPWO19H3L6fSP0ZfrND/binxIGQh5mnYwwxXazYlijuZsZQFVwHAmkJY DM8FnRvo76eFDgdRamK2Ew3PeYrT/pYSduxLOMPcYxxwxIQq6JbgCOijApsbwKSQ6WEb R6jw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r24si3867432edy.417.2019.10.04.11.35.51; Fri, 04 Oct 2019 11:36:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729932AbfJDSex (ORCPT + 99 others); Fri, 4 Oct 2019 14:34:53 -0400 Received: from foss.arm.com ([217.140.110.172]:52144 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728882AbfJDSex (ORCPT ); Fri, 4 Oct 2019 14:34:53 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3D5D215A1; Fri, 4 Oct 2019 11:34:52 -0700 (PDT) Received: from [10.1.197.57] (e110467-lin.cambridge.arm.com [10.1.197.57]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7C2143F534; Fri, 4 Oct 2019 11:34:50 -0700 (PDT) Subject: Re: [PATCH v2] iommu/arm-smmu: Break insecure users by disabling bypass by default To: Tim Harvey , Tirumalesh Chalamarla Cc: Douglas Anderson , Joerg Roedel , Will Deacon , linux-arm-msm@vger.kernel.org, evgreen@chromium.org, tfiga@chromium.org, Rob Clark , iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, Vivek Gautam , open list References: <20190301192017.39770-1-dianders@chromium.org> <5dce2964-8761-e7d0-8963-f0f5cb2feb02@arm.com> <1f6f7eb0-e1dc-d5a8-fb38-44c5bd839894@arm.com> <5cf9ec03-f6fb-8227-4ec5-62445038f283@arm.com> From: Robin Murphy Message-ID: Date: Fri, 4 Oct 2019 19:34:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/10/2019 18:13, Tim Harvey wrote: [...] >>> No difference... still need 'arm-smmu.disable_bypass=n' to boot. Are >>> all four iommu-map props above supposed to be the same? Seems to me >>> they all point to the same thing which looks wrong. >> >> Hmm... :/ >> >> Those mappings just set Stream ID == PCI RID (strictly each one should >> only need to cover the bus range assigned to that bridge, but it's not >> crucial) which is the same thing the driver assumes for the mmu-masters >> property, so either that's wrong and never could have worked anyway - >> have you tried VFIO on this platform? - or there are other devices also >> mastering through the SMMU that aren't described at all. Are you able to >> capture a boot log? The SMMU faults do encode information about the >> offending ID, and you can typically correlate their appearance >> reasonably well with endpoint drivers probing. >> > > Robin, > > VFIO is enabled in the kernel but I don't know anything about how to > test/use it: > $ grep VFIO .config > CONFIG_KVM_VFIO=y > CONFIG_VFIO_IOMMU_TYPE1=y > CONFIG_VFIO_VIRQFD=y > CONFIG_VFIO=y > # CONFIG_VFIO_NOIOMMU is not set > CONFIG_VFIO_PCI=y > CONFIG_VFIO_PCI_MMAP=y > CONFIG_VFIO_PCI_INTX=y > # CONFIG_VFIO_PLATFORM is not set > # CONFIG_VFIO_MDEV is not set No worries - since it's a networking-focused SoC I figured there was a chance you might be using DPDK or similar userspace drivers with the NIC VFs, but I was just casting around for a quick and easy baseline of whether the SMMU works at all (another way would be using Qemu to run a VM with one or more PCI devices assigned). > I do have a boot console yet I'm not seeing any smmu faults at all. > Perhaps I've mis-diagnosed the issue completely. To be clear when I > boot with arm-smmu.disable_bypass=y the serial console appears to not > accept input in userspace and with arm-smmu.disable_bypass=n I'm fine. > I'm using a buildroot initramfs rootfs for simplicity. The system > isn't hung as I originally expected as the LED heartbeat trigger > continues blinking... I just can't get console to accept input. Curiouser and curiouser... I'm inclined to suspect that the interrupt configuration might also be messed up, such that the SMMU is blocking traffic and jammed up due to pending faults, but you're not getting the IRQ delivered to find out. Does this patch help reveal anything? http://linux-arm.org/git?p=linux-rm.git;a=commitdiff;h=29ac3648b580920692c9b417b2fc606995826517 (untested, but it's a direct port of the one I've used for SMMUv3 to diagnose something similar) That said, it's also puzzling that no other drivers are reporting DMA errors or timeouts either - is there any chance that some device is set running by the firmware/bootloader and not taken over by a kernel driver? Robin.