From patchwork Tue Oct 8 15:25:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Tyshchenko X-Patchwork-Id: 11179763 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9383D1709 for ; Tue, 8 Oct 2019 15:27:05 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6F5CF206C0 for ; Tue, 8 Oct 2019 15:27:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="n9ppuvVY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6F5CF206C0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iHrMX-0004Xq-Am; Tue, 08 Oct 2019 15:25:21 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iHrMW-0004Xl-FS for xen-devel@lists.xenproject.org; Tue, 08 Oct 2019 15:25:20 +0000 X-Inumbo-ID: d5db8ab4-e9df-11e9-80e3-bc764e2007e4 Received: from mail-lj1-x243.google.com (unknown [2a00:1450:4864:20::243]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d5db8ab4-e9df-11e9-80e3-bc764e2007e4; Tue, 08 Oct 2019 15:25:19 +0000 (UTC) Received: by mail-lj1-x243.google.com with SMTP id f5so18012041ljg.8 for ; Tue, 08 Oct 2019 08:25:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=EgoNg0rDOVixSSUIvs0Qc5Y5gj5bOjJ9IcQIEZ8RSH8=; b=n9ppuvVY66KrySNNu4z/SzcCGiPTwE68rOY6dVseTYQ8dxZBD+Sf3LZOrZ52c5VT9C b8trwmQ3DuN3pR2jGT2u4x5M4OKgjjGBiuU2yw5bvVxpbpn/iuyLiUcysO7lsFfkVhws t2yTRTWh/6XSDeXbc4fHYan5p8y6EDHNwvUQkZX1QcAbYlHv4YPNo4NpkHa9kJ5jFk7d JvGX6q5tK7472RK7HVnDj2EKM0aD03r/bzfabRQh8N7L/Sh68hPNfzqgupQduZRlSfDx kVUtnPnWmn+4IM7MBhsy8LU1WkADzVAMPckkTsRqPqM6J7j4tgM2WHw6deed8V4/fx9o gwsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=EgoNg0rDOVixSSUIvs0Qc5Y5gj5bOjJ9IcQIEZ8RSH8=; b=VGstADtnVfkSRJLEIXcPGt/X9IsEt8CUkQelYDAonUCUlaeoB3p4aLAtQaONEh+X21 FcpWJwKzQexhb/5FVtyBOhDz64DT5oImQmHnWY9Mv3wpQlbl5KXBoZldY1feO6KSEPkb bKMm06o3FCwj6JUyzLNesuUJyFHojiWN4aP4FiNj97NXBDgba1oljwcuaSRKOJpSX2zb zJm8XR473vOdgPmBx8Vvd64d1EGWtAxMkLysMZyGb1tOfcXYbkNVjR1l7aMh4yPN9glf nG4wbqem2NQooDLScBN7M/MORoQjNtA5N9RasGn4zrnZzG71YGFeMl1411+PqPduxAUy S7NA== X-Gm-Message-State: APjAAAWGqyinZ+BtukU5FQV4r7jNJLxENJGDW13N2exn0M5HBzOEplDD ezERDvmA4/qDm1ZR2w8vbr7SskYI/uM= X-Google-Smtp-Source: APXvYqxyVHXj3s5+PiKOIzrsYZDM3xI5TztxGfLhNlj0LJd9Co9B/cCOGDYhRfKNb4R+YJPGzjy0wQ== X-Received: by 2002:a2e:3808:: with SMTP id f8mr22500837lja.7.1570548317959; Tue, 08 Oct 2019 08:25:17 -0700 (PDT) Received: from otyshchenko.kyiv.epam.com (ll-74.141.223.85.sovam.net.ua. [85.223.141.74]) by smtp.gmail.com with ESMTPSA id h12sm3984783ljg.24.2019.10.08.08.25.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Oct 2019 08:25:17 -0700 (PDT) From: Oleksandr Tyshchenko To: xen-devel@lists.xenproject.org Date: Tue, 8 Oct 2019 18:25:04 +0300 Message-Id: <1570548304-12020-1-git-send-email-olekstysh@gmail.com> X-Mailer: git-send-email 2.7.4 Subject: [Xen-devel] [PATCH for-4.13 v2] xen/arm: domain_build: Don't expose IOMMU specific properties to hwdom X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Oleksandr Tyshchenko , julien.grall@arm.com, sstabellini@kernel.org, volodymyr_babchuk@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Oleksandr Tyshchenko We don't passthrough IOMMU device to hwdom even if it is not used by Xen. Therefore exposing the properties that describe relationship between master devices and IOMMUs does not make any sense. According to the: 1. Documentation/devicetree/bindings/iommu/iommu.txt 2. Documentation/devicetree/bindings/pci/pci-iommu.txt Signed-off-by: Oleksandr Tyshchenko --- Changes V1 [1] -> V2: - Only skip IOMMU specific properties of the master device if we skip the corresponding IOMMU device - Use "hwdom" over "Dom0" [1] https://lists.xenproject.org/archives/html/xen-devel/2019-10/msg00104.html --- xen/arch/arm/domain_build.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 6d6dd52..a7321b8 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -480,10 +480,26 @@ static int __init write_properties(struct domain *d, struct kernel_info *kinfo, const struct dt_property *prop, *status = NULL; int res = 0; int had_dom0_bootargs = 0; + struct dt_device_node *iommu_node; if ( kinfo->cmdline && kinfo->cmdline[0] ) bootargs = &kinfo->cmdline[0]; + /* + * If we skip the IOMMU device when creating DT for hwdom (even if + * the IOMMU device is not used by Xen), we should also skip the IOMMU + * specific properties of the master device behind it in order to avoid + * exposing an half complete IOMMU bindings to hwdom. + * Use "iommu_node" as an indicator of the master device which properties + * should be skipped. + */ + iommu_node = dt_parse_phandle(node, "iommus", 0); + if ( iommu_node ) + { + if ( device_get_class(iommu_node) != DEVICE_IOMMU ) + iommu_node = NULL; + } + dt_for_each_property_node (node, prop) { const void *prop_data = prop->value; @@ -540,6 +556,19 @@ static int __init write_properties(struct domain *d, struct kernel_info *kinfo, continue; } + if ( iommu_node ) + { + /* Don't expose IOMMU specific properties to hwdom */ + if ( dt_property_name_is_equal(prop, "iommus") ) + continue; + + if ( dt_property_name_is_equal(prop, "iommu-map") ) + continue; + + if ( dt_property_name_is_equal(prop, "iommu-map-mask") ) + continue; + } + res = fdt_property(kinfo->fdt, prop->name, prop_data, prop_len); if ( res )